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.
This commit is contained in:
parent
74912993de
commit
a2a0717c99
1 changed files with 7 additions and 4 deletions
|
@ -121,7 +121,7 @@ sendpack(Conn *c)
|
||||||
int nours, ntheirs, nmap;
|
int nours, ntheirs, nmap;
|
||||||
char buf[Pktmax], *sp[3];
|
char buf[Pktmax], *sp[3];
|
||||||
Hash h, *theirs, *ours;
|
Hash h, *theirs, *ours;
|
||||||
Object *a, *b, *p;
|
Object *a, *b, *p, *o;
|
||||||
char **refs;
|
char **refs;
|
||||||
Capset cs;
|
Capset cs;
|
||||||
Map *map, *m;
|
Map *map, *m;
|
||||||
|
@ -155,9 +155,12 @@ sendpack(Conn *c)
|
||||||
theirs = earealloc(theirs, ntheirs+1, sizeof(Hash));
|
theirs = earealloc(theirs, ntheirs+1, sizeof(Hash));
|
||||||
if(hparse(&theirs[ntheirs], sp[0]) == -1)
|
if(hparse(&theirs[ntheirs], sp[0]) == -1)
|
||||||
sysfatal("invalid hash %s", sp[0]);
|
sysfatal("invalid hash %s", sp[0]);
|
||||||
if((idx = findkey(map, nmap, sp[1])) != -1)
|
if((o = readobject(theirs[ntheirs])) != nil){
|
||||||
map[idx].theirs = theirs[ntheirs];
|
if((idx = findkey(map, nmap, sp[1])) != -1)
|
||||||
ntheirs++;
|
map[idx].theirs = theirs[ntheirs];
|
||||||
|
ntheirs++;
|
||||||
|
unref(o);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(writephase(c) == -1)
|
if(writephase(c) == -1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue