git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Users of git-check-files?

From
Junio C Hamano <junkio@cox.net>
Date
Aug 3, 2005, 18:07 UTC
Message-ID
<7vy87ic2sd.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0508031048360.3258@g5.osdl.org>
This patch seems to fix the problem.
 * If the original value of remote ref refers to an object we do
   not have, and if the ref is one of the branches we are trying
   to push, we refuse to update it.
 * Otherwise, we do not attempt to use such an value when
   computing what objects to put in pack, since rev-list would
   fail.

I've tested Josef's two-branches case, one repo updates one branch and pushes to the central repo, another repo updates the other branch and pushed to the central repo. The old code barfed when invoking rev-list, but this does not seem to.

Josef, could you give it a try please?

--- cd /opt/packrat/playpen/public/in-place/git/git.junio/ jit-diff # - master: git-send-email-script: minimum whitespace cleanup. # + (working tree)

diff --git a/send-pack.c b/send-pack.c
--- a/send-pack.c
+++ b/send-pack.c
@@ -43,7 +43,8 @@ static void exec_rev_list(struct ref *re
 		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;
@@ -208,6 +209,12 @@ static int send_pack(int in, int out, in
 			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;
+		}
+
 		/* Ok, mark it for update */
 		memcpy(ref->new_sha1, new_sha1, 20);
 	}

Compilation finished at Wed Aug  3 11:02:15
Previous: Linus TorvaldsNext: Josef Weidendorfer
Message 33 of 37 in “Users of git-check-files?”
  1. Johannes SchindelinAug 2, 2005
  2. Linus TorvaldsAug 3, 2005
  3. Junio C HamanoAug 3, 2005
  4. Johannes SchindelinAug 3, 2005
  5. Linus TorvaldsAug 3, 2005
  6. Johannes SchindelinAug 3, 2005
  7. Linus TorvaldsAug 3, 2005
  8. Junio C HamanoAug 3, 2005
  9. Linus TorvaldsAug 3, 2005
  10. Junio C HamanoAug 3, 2005
  11. Linus TorvaldsAug 3, 2005
  12. Johannes SchindelinAug 3, 2005
  13. Josef WeidendorferAug 3, 2005
  14. Junio C HamanoAug 3, 2005
  15. Josef WeidendorferAug 3, 2005
  16. Linus TorvaldsAug 3, 2005
  17. (preview) Renaming push.Junio C Hamano, Aug 3, 2005
  18. Linus TorvaldsAug 3, 2005
  19. Junio C HamanoAug 4, 2005
  20. Linus TorvaldsAug 4, 2005
  21. Junio C HamanoAug 4, 2005
  22. Junio C HamanoAug 4, 2005
  23. Linus TorvaldsAug 4, 2005
  24. Junio C HamanoAug 4, 2005
  25. Teach rev-list since..til notation.Junio C Hamano, Aug 4, 2005
  26. Linus TorvaldsAug 3, 2005
  27. Junio C HamanoAug 3, 2005
  28. Linus TorvaldsAug 3, 2005
  29. Junio C HamanoAug 3, 2005
  30. Josef WeidendorferAug 3, 2005
  31. Linus TorvaldsAug 3, 2005
  32. Linus TorvaldsAug 3, 2005
  33. Junio C HamanoAug 3, 2005
  34. Josef WeidendorferAug 3, 2005
  35. Johannes SchindelinAug 3, 2005
  36. Junio C HamanoAug 4, 2005
  37. Johannes SchindelinAug 4, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.