commit - 1fe43c07073b0aa6cbdda5b13c4164f820ac8b6c
commit + ea83355f0a329b34b741dffc0cd0542ed96afb9a
blob - a1411592681076c2aecbb0ca5517c9c3c2971ea2
blob + 14f895c1ec910a384eec39f6e8d68c60ffa65538
--- lib/fetch.c
+++ lib/fetch.c
&packfile_size_cur, (*pack_hash)->sha1, &fetchibuf);
if (err != NULL)
goto done;
+ /* Don't report size progress for an empty pack file. */
+ if (packfile_size_cur <= ssizeof(pack_hdr) + SHA1_DIGEST_LENGTH)
+ packfile_size_cur = 0;
if (!done && refname && id) {
err = got_pathlist_insert(NULL, refs, refname, id);
if (err)
* If the pack file contains no objects, we may only need to update
* references in our repository. The caller will take care of that.
*/
- if (nobj == 0)
+ if (nobj == 0) {
+ free(*pack_hash);
+ *pack_hash = NULL;
goto done;
+ }
if (lseek(packfd, 0, SEEK_SET) == -1) {
err = got_error_from_errno("lseek");
blob - 005914093bf904b0e5687ccc411f6f975c1e2219
blob + 9d5b83b348179ccd30d944a9e9e50183e0a4a458
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
struct got_object *indexed;
static int chattygot;
-static struct got_object_id zhash = {.sha1={0}};
static const struct got_capability got_capabilities[] = {
{ GOT_CAPA_AGENT, "got/" GOT_VERSION_STR },
if (nwant == 0)
goto done;
- for (i = 0; i < nref; i++) {
- if (got_object_id_cmp(&have[i], &zhash) == 0)
- continue;
- got_sha1_digest_to_str(have[i].sha1, hashstr, sizeof(hashstr));
+ TAILQ_FOREACH(pe, have_refs, entry) {
+ struct got_object_id *id = pe->data;
+ got_sha1_digest_to_str(id->sha1, hashstr, sizeof(hashstr));
n = snprintf(buf, sizeof(buf), "have %s\n", hashstr);
if (n >= sizeof(buf)) {
err = got_error(GOT_ERR_NO_SPACE);