Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make pack.indexversion config option default to version 2

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>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
  • Loading branch information...
commit 22fbd6a557f3df19a8bf9d6dad6b5069578b159e 1 parent 0ad9b72
@spearce spearce authored robinrosenberg committed
View
4 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);
View
3  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);
}
/**
View
1  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();
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.