From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: [JGIT PATCH 9/9] Make pack.indexversion config option default to version 2
Date: Wed, 11 Feb 2009 18:36:59 -0800 [thread overview]
Message-ID: <1234406219-19547-10-git-send-email-spearce@spearce.org> (raw)
In-Reply-To: <1234406219-19547-9-git-send-email-spearce@spearce.org>
Git 1.6.0 (released Sun Aug 17 11:42:22 2008 -0700) defaults
to creating the much safer pack index version 2 format when
writing a pack to disk. Most clients trying to use Git will
be running a recent version of C Git alongside JGit so it is
reasonably safe to assume they have index version 2 reading
support, and are thus prepared to accept this change in the
default output format.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
.../src/org/spearce/jgit/pgm/IndexPack.java | 4 +++-
.../src/org/spearce/jgit/lib/CoreConfig.java | 3 ++-
.../src/org/spearce/jgit/lib/PackWriter.java | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/IndexPack.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/IndexPack.java
index 5eacaa4..22803a4 100644
--- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/IndexPack.java
+++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/IndexPack.java
@@ -49,13 +49,15 @@
private boolean fixThin;
@Option(name = "--index-version", usage = "index file format to create")
- private int indexVersion;
+ private int indexVersion = -1;
@Argument(index = 0, required = true, metaVar = "base")
private File base;
@Override
protected void run() throws Exception {
+ if (indexVersion == -1)
+ indexVersion = db.getConfig().getCore().getPackIndexVersion();
final BufferedInputStream in;
final org.spearce.jgit.transport.IndexPack ip;
in = new BufferedInputStream(System.in);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/CoreConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/CoreConfig.java
index 2dd8aea..e98e0bc 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/CoreConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/CoreConfig.java
@@ -45,6 +45,7 @@
*/
public class CoreConfig {
private static final int DEFAULT_COMPRESSION = Deflater.DEFAULT_COMPRESSION;
+ private static final int DEFAULT_INDEXVERSION = 2;
private final int compression;
@@ -52,7 +53,7 @@
CoreConfig(final RepositoryConfig rc) {
compression = rc.getInt("core", "compression", DEFAULT_COMPRESSION);
- packIndexVersion = rc.getInt("pack", "indexversion", 0);
+ packIndexVersion = rc.getInt("pack", "indexversion", DEFAULT_INDEXVERSION);
}
/**
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
index cba2ee7..f9945c4 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
@@ -237,6 +237,7 @@ public PackWriter(final Repository repo, final ProgressMonitor imonitor,
initMonitor = imonitor;
writeMonitor = wmonitor;
this.deflater = new Deflater(db.getConfig().getCore().getCompression());
+ outputVersion = repo.getConfig().getCore().getPackIndexVersion();
}
/**
--
1.6.2.rc0.204.gf6b427
prev parent reply other threads:[~2009-02-12 2:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-12 2:36 [JGIT PATCH 0/9] Misc. pack code cleanups Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 1/9] Remove the Repository parameter from PackFile's constructor Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 2/9] Remove dead stats code from WindowCache Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 3/9] Document why WindowFile's hash is *31 Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 4/9] Allow PackFile to lazily load its PackIndex on first demand Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 5/9] Arrange pack files in recency order to improve quick hits Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 6/9] Rename readPackHeader() to be onOpenPack() Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 7/9] Validate the pack's footer checksum matches that in the index Shawn O. Pearce
2009-02-12 2:36 ` [JGIT PATCH 8/9] Remove yet another legacy StGit utility function Shawn O. Pearce
2009-02-12 2:36 ` Shawn O. Pearce [this message]
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=1234406219-19547-10-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;
as well as URLs for NNTP newsgroup(s).