Git development
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 2/1] Honor repack.usedeltabaseoffset when fetching packs
Date: Fri,  1 May 2009 15:00:24 -0700	[thread overview]
Message-ID: <1241215224-29374-1-git-send-email-spearce@spearce.org> (raw)

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.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---

 I just realized we don't honor this during fetch, and we should.

 .../jgit/transport/BasePackFetchConnection.java    |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java
index b75e0ef..b51ce23 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/BasePackFetchConnection.java
@@ -49,6 +49,7 @@
 import org.spearce.jgit.lib.ObjectId;
 import org.spearce.jgit.lib.ProgressMonitor;
 import org.spearce.jgit.lib.Ref;
+import org.spearce.jgit.lib.RepositoryConfig;
 import org.spearce.jgit.revwalk.RevCommit;
 import org.spearce.jgit.revwalk.RevCommitList;
 import org.spearce.jgit.revwalk.RevFlag;
@@ -126,10 +127,15 @@
 
 	private boolean includeTags;
 
+	private boolean allowOfsDelta;
+
 	BasePackFetchConnection(final PackTransport packTransport) {
 		super(packTransport);
+
+		final RepositoryConfig cfg = local.getConfig();
 		includeTags = transport.getTagOpt() != TagOpt.NO_TAGS;
 		thinPack = transport.isFetchThin();
+		allowOfsDelta = cfg.getBoolean("repack", "usedeltabaseoffset", true);
 
 		walk = new RevWalk(local);
 		reachableCommits = new RevCommitList<RevCommit>();
@@ -282,7 +288,8 @@ private String enableCapabilities() {
 		final StringBuilder line = new StringBuilder();
 		if (includeTags)
 			includeTags = wantCapability(line, OPTION_INCLUDE_TAG);
-		wantCapability(line, OPTION_OFS_DELTA);
+		if (allowOfsDelta)
+			wantCapability(line, OPTION_OFS_DELTA);
 		multiAck = wantCapability(line, OPTION_MULTI_ACK);
 		if (thinPack)
 			thinPack = wantCapability(line, OPTION_THIN_PACK);
-- 
1.6.3.rc3.212.g8c698

             reply	other threads:[~2009-05-01 22:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-01 22:00 Shawn O. Pearce [this message]
2009-05-01 23:19 ` [JGIT PATCH 2/1] Honor repack.usedeltabaseoffset when fetching packs Nicolas Pitre
2009-05-02  0:18   ` [PATCH] honor " Nicolas Pitre

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=1241215224-29374-1-git-send-email-spearce@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox