Download raw body.
improve got fetch error reporting
On 2023/02/04 17:34:21 +0100, Stefan Sperling <stsp@stsp.name> wrote: > With the new 'got fetch' default behaviour it can be a bit > unclear why the fetch operation is failing: > > $ got fetch > got-fetch-pack: could not find any branches to fetch > got: could not find any branches to fetch > $ got branch > fetch-verify > > > With the patch below: > > $ got fetch > got-fetch-pack: branch "refs/heads/fetch-verify" not found on server: could not find any branches to fetch > got: could not find any branches to fetch > $ > > ok? the error message becomes quite long but surely better than before. ok op@ > diff /home/stsp/src/got > commit - 4ba151fd9e5cc3e537a47f063a95c894a6c5bed7 > path + /home/stsp/src/got > blob - 77ba914fb971f5e412b57bd1633bda6ee0e1f26d > file + libexec/got-fetch-pack/got-fetch-pack.c > --- libexec/got-fetch-pack/got-fetch-pack.c > +++ libexec/got-fetch-pack/got-fetch-pack.c > @@ -484,6 +484,24 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1, > > /* Abort if we haven't found any branch to fetch. */ > if (!found_branch) { > + struct got_pathlist_entry *pe; > + > + pe = TAILQ_FIRST(wanted_branches); > + if (pe) { > + err = got_error_fmt(GOT_ERR_FETCH_NO_BRANCH, > + "branch \"%s\" not found on server", > + pe->path); > + goto done; > + } > + > + pe = TAILQ_FIRST(wanted_refs); > + if (pe) { > + err = got_error_fmt(GOT_ERR_FETCH_NO_BRANCH, > + "reference \"%s\" not found on server", > + pe->path); > + goto done; > + } > + > err = got_error(GOT_ERR_FETCH_NO_BRANCH); > goto done; > }
improve got fetch error reporting