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

[PATCH] honor repack.usedeltabaseoffset when fetching packs

From
Nicolas Pitre <nico@cam.org>
Date
May 2, 2009, 00:18 UTC
Message-ID
<alpine.LFD.2.00.0905012012380.6741@xanadu.home>
In-Reply-To
<alpine.LFD.2.00.0905011916130.6741@xanadu.home>

If the local receiving repository has disabled the use of delta base offset, for example to retain compatibility with older versions of Git that predate OFS_DELTA, we shouldn't ask for ofs-delta support when we obtain a pack from the remote server.

[ issue noticed by Shawn Pearce ]
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
On Fri, 1 May 2009, Nicolas Pitre wrote:
> Good point.  I doubt it actually matters in practice or we would have 
> heard about some complaints by now.  But for consistency sake I should 
> produce a similar patch for C git as well.
Here it is, with commit log stolen from Shawn's JGit patch.
 builtin-fetch-pack.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c
index 5d134be..012d044 100644
--- a/builtin-fetch-pack.c
+++ b/builtin-fetch-pack.c
@@ -13,6 +13,7 @@
 static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
 static int unpack_limit = 100;
+static int prefer_ofs_delta = 1;
 static struct fetch_pack_args args = {
 	/* .uploadpack = */ "git-upload-pack",
 };
@@ -200,7 +201,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
 				     (args.use_thin_pack ? " thin-pack" : ""),
 				     (args.no_progress ? " no-progress" : ""),
 				     (args.include_tag ? " include-tag" : ""),
-				     " ofs-delta");
+				     (prefer_ofs_delta ? " ofs-delta" : ""));
 		else
 			packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
 		fetching++;
@@ -596,6 +597,11 @@ static struct ref *do_fetch_pack(int fd[2],
 			fprintf(stderr, "Server supports side-band\n");
 		use_sideband = 1;
 	}
+	if (server_supports("ofs-delta")) {
+		if (args.verbose)
+			fprintf(stderr, "Server supports ofs-delta\n");
+	} else
+		prefer_ofs_delta = 0;
 	if (everything_local(&ref, nr_match, match)) {
 		packet_flush(fd[1]);
 		goto all_done;
@@ -648,6 +654,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
+	if (strcmp(var, "repack.usedeltabaseoffset") == 0) {
+		prefer_ofs_delta = git_config_bool(var, value);
+		return 0;
+	}
+
 	return git_default_config(var, value, cb);
 }
 
Previous: Nicolas Pitre
Message 3 of 3 in “Honor repack.usedeltabaseoffset when fetching packs”
  1. 2/1 Honor repack.usedeltabaseoffset when fetching packsShawn O. Pearce, May 1, 2009
  2. Nicolas PitreMay 1, 2009
  3. honor repack.usedeltabaseoffset when fetching packsNicolas Pitre, May 2, 2009

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.