Browse Source

Always add FileExt to DfsPackDescription

Instead of forcing the implementation of the DFS backend to handle
making sure the extension bits are set correctly, have the common
callers in JGit set the extension at the same time they supply the
file sizes to the pack description. This simplifies assumptions for
an implementation of the DFS backend.

Change-Id: I55142ad8ea08a3e2e8349f72b3714578eba9c342
stable-3.0
Shawn Pearce 12 years ago
parent
commit
7f1c2ec1eb
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
  3. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
  4. 1
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java

@ -358,6 +358,7 @@ public class DfsGarbageCollector {
out = objdb.writeFile(pack, PACK);
try {
pw.writePack(pm, pm, out);
pack.addFileExt(PACK);
} finally {
out.close();
}
@ -366,6 +367,7 @@ public class DfsGarbageCollector {
try {
CountingOutputStream cnt = new CountingOutputStream(out);
pw.writeIndex(cnt);
pack.addFileExt(INDEX);
pack.setFileSize(INDEX, cnt.getCount());
pack.setIndexVersion(pw.getIndexVersion());
} finally {
@ -377,6 +379,7 @@ public class DfsGarbageCollector {
try {
CountingOutputStream cnt = new CountingOutputStream(out);
pw.writeBitmapIndex(cnt);
pack.addFileExt(BITMAP_INDEX);
pack.setFileSize(BITMAP_INDEX, cnt.getCount());
} finally {
out.close();

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java

@ -153,6 +153,7 @@ public class DfsInserter extends ObjectInserter {
throw new IOException();
byte[] packHash = packOut.writePackFooter();
packDsc.addFileExt(PACK);
packDsc.setFileSize(PACK, packOut.getCount());
packOut.close();
packOut = null;
@ -261,6 +262,7 @@ public class DfsInserter extends ObjectInserter {
buf.writeTo(cnt, null);
else
index(cnt, packHash, list);
pack.addFileExt(INDEX);
pack.setFileSize(INDEX, cnt.getCount());
} finally {
os.close();

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java

@ -289,6 +289,7 @@ public class DfsPackCompactor {
DfsOutputStream out = objdb.writeFile(pack, PACK);
try {
pw.writePack(pm, pm, out);
pack.addFileExt(PACK);
} finally {
out.close();
}
@ -301,6 +302,7 @@ public class DfsPackCompactor {
try {
CountingOutputStream cnt = new CountingOutputStream(out);
pw.writeIndex(cnt);
pack.addFileExt(INDEX);
pack.setFileSize(INDEX, cnt.getCount());
pack.setIndexVersion(pw.getIndexVersion());
} finally {

1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java

@ -148,6 +148,7 @@ public class DfsPackParser extends PackParser {
out = null;
currBuf = null;
readBlock = null;
packDsc.addFileExt(PACK);
packDsc.setFileSize(PACK, packEnd);
writePackIndex();

Loading…
Cancel
Save