{"thread":{"id":"19151","subject":"[JGIT PATCH 2/1] Honor repack.usedeltabaseoffset when fetching packs","startedAt":"2009-05-01T22:00:24Z","lastAt":"2009-05-02T00:18:02Z","messageCount":3,"participants":["Shawn O. Pearce","Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"112843","messageId":"1241215224-29374-1-git-send-email-spearce@spearce.org","threadId":"19151","inReplyTo":null,"subject":"[JGIT PATCH 2/1] Honor repack.usedeltabaseoffset when fetching packs","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-05-01T22:00:24Z","receivedAt":"2009-05-01T22:00:24Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the local receiving repository has disabled the use of delta base\noffset, for example to retain compatibility with older versions of\nGit that predate OFS_DELTA, we shouldn't ask for ofs-delta support\nwhen we obtain a pack from the remote server.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n\n I just realized we don't honor this during fetch, and we should.\n\n .../jgit/transport/BasePackFetchConnection.java    |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java\nindex b75e0ef..b51ce23 100644\n--- a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java\n+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java\n@@ -49,6 +49,7 @@\n import org.spearce.jgit.lib.ObjectId;\n import org.spearce.jgit.lib.ProgressMonitor;\n import org.spearce.jgit.lib.Ref;\n+import org.spearce.jgit.lib.RepositoryConfig;\n import org.spearce.jgit.revwalk.RevCommit;\n import org.spearce.jgit.revwalk.RevCommitList;\n import org.spearce.jgit.revwalk.RevFlag;\n@@ -126,10 +127,15 @@\n \n \tprivate boolean includeTags;\n \n+\tprivate boolean allowOfsDelta;\n+\n \tBasePackFetchConnection(final PackTransport packTransport) {\n \t\tsuper(packTransport);\n+\n+\t\tfinal RepositoryConfig cfg = local.getConfig();\n \t\tincludeTags = transport.getTagOpt() != TagOpt.NO_TAGS;\n \t\tthinPack = transport.isFetchThin();\n+\t\tallowOfsDelta = cfg.getBoolean(\"repack\", \"usedeltabaseoffset\", true);\n \n \t\twalk = new RevWalk(local);\n \t\treachableCommits = new RevCommitList<RevCommit>();\n@@ -282,7 +288,8 @@ private String enableCapabilities() {\n \t\tfinal StringBuilder line = new StringBuilder();\n \t\tif (includeTags)\n \t\t\tincludeTags = wantCapability(line, OPTION_INCLUDE_TAG);\n-\t\twantCapability(line, OPTION_OFS_DELTA);\n+\t\tif (allowOfsDelta)\n+\t\t\twantCapability(line, OPTION_OFS_DELTA);\n \t\tmultiAck = wantCapability(line, OPTION_MULTI_ACK);\n \t\tif (thinPack)\n \t\t\tthinPack = wantCapability(line, OPTION_THIN_PACK);\n-- \n1.6.3.rc3.212.g8c698\n"},{"id":"112850","messageId":"alpine.LFD.2.00.0905011916130.6741@xanadu.home","threadId":"19151","inReplyTo":"1241215224-29374-1-git-send-email-spearce@spearce.org","subject":"Re: [JGIT PATCH 2/1] Honor repack.usedeltabaseoffset when fetching packs","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2009-05-01T23:19:03Z","receivedAt":"2009-05-01T23:19:03Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Fri, 1 May 2009, Shawn O. Pearce wrote:\n\n> If the local receiving repository has disabled the use of delta base\n> offset, for example to retain compatibility with older versions of\n> Git that predate OFS_DELTA, we shouldn't ask for ofs-delta support\n> when we obtain a pack from the remote server.\n\nGood point.  I doubt it actually matters in practice or we would have \nheard about some complaints by now.  But for consistency sake I should \nproduce a similar patch for C git as well.\n\n\nNicolas\n"},{"id":"112854","messageId":"alpine.LFD.2.00.0905012012380.6741@xanadu.home","threadId":"19151","inReplyTo":"alpine.LFD.2.00.0905011916130.6741@xanadu.home","subject":"[PATCH] honor repack.usedeltabaseoffset when fetching packs","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2009-05-02T00:18:02Z","receivedAt":"2009-05-02T00:18:02Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"If the local receiving repository has disabled the use of delta base\noffset, for example to retain compatibility with older versions of\nGit that predate OFS_DELTA, we shouldn't ask for ofs-delta support\nwhen we obtain a pack from the remote server.\n\n[ issue noticed by Shawn Pearce ]\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n\nOn Fri, 1 May 2009, Nicolas Pitre wrote:\n\n> Good point.  I doubt it actually matters in practice or we would have \n> heard about some complaints by now.  But for consistency sake I should \n> produce a similar patch for C git as well.\n\nHere it is, with commit log stolen from Shawn's JGit patch.\n\n builtin-fetch-pack.c |   13 ++++++++++++-\n 1 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c\nindex 5d134be..012d044 100644\n--- a/builtin-fetch-pack.c\n+++ b/builtin-fetch-pack.c\n@@ -13,6 +13,7 @@\n static int transfer_unpack_limit = -1;\n static int fetch_unpack_limit = -1;\n static int unpack_limit = 100;\n+static int prefer_ofs_delta = 1;\n static struct fetch_pack_args args = {\n \t/* .uploadpack = */ \"git-upload-pack\",\n };\n@@ -200,7 +201,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,\n \t\t\t\t     (args.use_thin_pack ? \" thin-pack\" : \"\"),\n \t\t\t\t     (args.no_progress ? \" no-progress\" : \"\"),\n \t\t\t\t     (args.include_tag ? \" include-tag\" : \"\"),\n-\t\t\t\t     \" ofs-delta\");\n+\t\t\t\t     (prefer_ofs_delta ? \" ofs-delta\" : \"\"));\n \t\telse\n \t\t\tpacket_write(fd[1], \"want %s\\n\", sha1_to_hex(remote));\n \t\tfetching++;\n@@ -596,6 +597,11 @@ static struct ref *do_fetch_pack(int fd[2],\n \t\t\tfprintf(stderr, \"Server supports side-band\\n\");\n \t\tuse_sideband = 1;\n \t}\n+\tif (server_supports(\"ofs-delta\")) {\n+\t\tif (args.verbose)\n+\t\t\tfprintf(stderr, \"Server supports ofs-delta\\n\");\n+\t} else\n+\t\tprefer_ofs_delta = 0;\n \tif (everything_local(&ref, nr_match, match)) {\n \t\tpacket_flush(fd[1]);\n \t\tgoto all_done;\n@@ -648,6 +654,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)\n \t\treturn 0;\n \t}\n \n+\tif (strcmp(var, \"repack.usedeltabaseoffset\") == 0) {\n+\t\tprefer_ofs_delta = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \treturn git_default_config(var, value, cb);\n }\n \n"}]}