9front - general discussion about 9front
 help / color / mirror / Atom feed
From: ori@eigenstate.org
To: 9front@9front.org
Subject: [9front] git/send: fill in 'theirs' object, even if we miss it
Date: Sat, 16 Apr 2022 20:38:06 -0400	[thread overview]
Message-ID: <CF5C7F36FF2C585A427B76A5AC84FBED@eigenstate.org> (raw)

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);
 		}


                 reply	other threads:[~2022-04-17  0:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CF5C7F36FF2C585A427B76A5AC84FBED@eigenstate.org \
    --to=ori@eigenstate.org \
    --cc=9front@9front.org \
    --subject='Re: [9front] git/send: fill in '\''theirs'\'' object, even if we miss it' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).