9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] git/send: fill in 'theirs' object, even if we miss it
@ 2022-04-17  0:38 ori
  0 siblings, 0 replies; only message in thread
From: ori @ 2022-04-17  0:38 UTC (permalink / raw)
  To: 9front

When pushing, git/send would sometimes decide we had all the
objects that we'd need to update the remote, and would try
to pack and send the entire history of the repository. This
is because we only set the 'theirs' ref when we had the object.

If we didn't have the object, we would set a zero hash,
then when deciding if we needed to force, we would think
that we were updating a new branch and send everything,
which would fail to update the remote.
---
diff 4e4ba65d588d67b17745145b99d314c9203618b8 34677e8dd3a32a9458918bd8e1300fab4694fd7e
--- a/sys/src/cmd/git/send.c	Sat Apr 16 20:22:43 2022
+++ b/sys/src/cmd/git/send.c	Sat Apr 16 20:32:27 2022
@@ -134,8 +134,8 @@
 	nmap = nours;
 	map = eamalloc(nmap, sizeof(Map));
 	for(i = 0; i < nmap; i++){
-		map[i].ours = ours[i];
 		map[i].theirs = Zhash;
+		map[i].ours = ours[i];
 		map[i].ref = refs[i];
 	}
 	while(1){
@@ -155,9 +155,9 @@
 		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];
 		if((o = readobject(theirs[ntheirs])) != nil){
-			if((idx = findkey(map, nmap, sp[1])) != -1)
-				map[idx].theirs = theirs[ntheirs];
 			ntheirs++;
 			unref(o);
 		}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-17  0:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-17  0:38 [9front] git/send: fill in 'theirs' object, even if we miss it ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).