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

Re: [PATCH] improved delta support for git

From
Junio C Hamano <junkio@cox.net>
Date
May 12, 2005, 04:36 UTC
Message-ID
<7voebhkql5.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.62.0505112309480.5426@localhost.localdomain>

The changes to sha1_file interface seems to be contained to read_sha1_file() only; which is a very good sign. You have already expressed that you are aware that fsck-cache needs to be taught about the delta objects, so I'd trust that would be what you will be tackling next.

I started wondering how the delta chains would affect pull.c, the engine that decides which files under GIT_OBJECT_DIRECTORY need to be pulled from the remote side in order to construct the set of objects needed by the given commit ID, under various combinations of cut-off criteria given with -c, -t, and -a options.

It appears to me that changes to the make_sure_we_have_it() routine along the following lines (completely untested) would suffice. Instead of just returning success, we first fetch the named object from the remote side, read it to see if it is really the object we have asked, or just a delta, and if it is a delta call itself again on the underlying object that delta object depends upon.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
# - git-pb: Fixed a leak in read-tree
# + (working tree)
--- a/pull.c
+++ b/pull.c
@@ -32,11 +32,23 @@ static void report_missing(const char *w
 static int make_sure_we_have_it(const char *what, unsigned char *sha1)
 {
 	int status;
+	unsigned long mapsize;
+	void *map, *buf;
+
 	if (has_sha1_file(sha1))
 		return 0;
 	status = fetch(sha1);
 	if (status && what)
 		report_missing(what, sha1);
+
+	map = map_sha1_file(sha1, &mapsize);
+	if (map) {
+		buf = unpack_sha1_file(map, mapsize, type, size);
+		munmap(map, mapsize);
+		if (buf && !strcmp(type, "delta"))
+			status = make_sure_we_have_it(what, buf);
+		free(buf);
+	}
 	return status;
 }
 
Previous: Nicolas PitreNext: Chris Mason
Message 2 of 17 in “improved delta support for git”
  1. improved delta support for gitNicolas Pitre, May 12, 2005
  2. Junio C HamanoMay 12, 2005
  3. Chris MasonMay 12, 2005
  4. Thomas GlanzmannMay 17, 2005
  5. Thomas GlanzmannMay 17, 2005
  6. Thomas GlanzmannMay 17, 2005
  7. Dan HolmsandMay 17, 2005
  8. Nicolas PitreMay 18, 2005
  9. Dan HolmsandMay 18, 2005
  10. Nicolas PitreMay 18, 2005
  11. Dan HolmsandMay 18, 2005
  12. Linus TorvaldsMay 18, 2005
  13. Dan HolmsandMay 18, 2005
  14. Jon SeymourMay 12, 2005
  15. Nicolas PitreMay 12, 2005
  16. Junio C HamanoMay 12, 2005
  17. Chris MasonMay 13, 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.