diff options
author | Junio C Hamano <junkio@cox.net> | 2005-08-03 12:41:12 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-08-03 12:41:12 -0700 |
commit | 40b64d47c3dd071c84445dece4003bb52a194339 (patch) | |
tree | 63db5d2bab36304a1e091422db3d3a36c9a21111 /send-pack.c | |
parent | 5825e5b25c557d977b6d877c19edc27322a8bf08 (diff) | |
download | git-40b64d47c3dd071c84445dece4003bb52a194339.tar.gz |
send-pack: handle partial pushes correctly.
When pushing into multi-user repository, or when pushing to a
repository from a local repository that has rebased branches
that has been pruned, the destination repository can have head
commits that are missing from the local repository.
This should not matter as long as the local head of the branch
being pushed is a proper superset of the destination branch, but
we ended up trying to run rev-list telling it to exclude objects
reachable from those heads missing from the local repository,
causing it to barf. Prune those heads from the rev-list
parameter list, and make sure we do not try to push a branch
whose remote head is something we lack.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'send-pack.c')
-rw-r--r-- | send-pack.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/send-pack.c b/send-pack.c index 5a3aff6822..3b66185401 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; |