diff --git a/send-pack.c b/send-pack.c index 5a3aff6822c424b814ed6ec3e6daa02f82581720..3b66185401adf2d7b5a1b40cb1b7ada0ee73396e 100644 --- a/send-pack.c +++ b/send-pack.c @@ -43,7 +43,8 @@ static void exec_rev_list(struct ref *refs) char *buf = malloc(100); if (i > 900) die("git-rev-list environment overflow"); - if (!is_zero_sha1(refs->old_sha1)) { + if (!is_zero_sha1(refs->old_sha1) && + has_sha1_file(refs->old_sha1)) { args[i++] = buf; snprintf(buf, 50, "^%s", sha1_to_hex(refs->old_sha1)); buf += 50; @@ -203,6 +204,12 @@ static int send_pack(int in, int out, int nr_match, char **match) continue; } + if (!has_sha1_file(ref->old_sha1)) { + error("remote '%s' object %s does not exist on local", + name, sha1_to_hex(ref->old_sha1)); + continue; + } + if (!ref_newer(new_sha1, ref->old_sha1)) { error("remote '%s' isn't a strict parent of local", name); continue;