diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-05 23:29:57 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-06 13:07:51 -0400 |
commit | a2a0717c99ab60bc0d7814fa22230013f9347c22 (patch) | |
tree | 13eacacc10917e3493d75f9e3b8f7955d7df8766 | |
parent | 74912993de657a9885d4c1f95ebf64b0c7d5083f (diff) | |
download | plan9front-a2a0717c99ab60bc0d7814fa22230013f9347c22.tar.xz |
git/send: allow the remote to have refs that we don't
It's not fatal for someone else to push a branch
with objects that we don't have. We should deal
with it gracefully, and act as though it doesn't
exist.
-rw-r--r-- | sys/src/cmd/git/send.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/src/cmd/git/send.c b/sys/src/cmd/git/send.c index 1e44caa81..877c369e5 100644 --- a/sys/src/cmd/git/send.c +++ b/sys/src/cmd/git/send.c @@ -121,7 +121,7 @@ sendpack(Conn *c) int nours, ntheirs, nmap; char buf[Pktmax], *sp[3]; Hash h, *theirs, *ours; - Object *a, *b, *p; + Object *a, *b, *p, *o; char **refs; Capset cs; Map *map, *m; @@ -155,9 +155,12 @@ sendpack(Conn *c) theirs = earealloc(theirs, ntheirs+1, sizeof(Hash)); if(hparse(&theirs[ntheirs], sp[0]) == -1) sysfatal("invalid hash %s", sp[0]); - if((idx = findkey(map, nmap, sp[1])) != -1) - map[idx].theirs = theirs[ntheirs]; - ntheirs++; + if((o = readobject(theirs[ntheirs])) != nil){ + if((idx = findkey(map, nmap, sp[1])) != -1) + map[idx].theirs = theirs[ntheirs]; + ntheirs++; + unref(o); + } } if(writephase(c) == -1) |