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
This commit is contained in:
parent
e7669c44e3
commit
7f1c2ec1eb
|
@ -358,6 +358,7 @@ private DfsPackDescription writePack(PackSource source, PackWriter pw,
|
|||
out = objdb.writeFile(pack, PACK);
|
||||
try {
|
||||
pw.writePack(pm, pm, out);
|
||||
pack.addFileExt(PACK);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
|
@ -366,6 +367,7 @@ private DfsPackDescription writePack(PackSource source, PackWriter pw,
|
|||
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 @@ private DfsPackDescription writePack(PackSource source, PackWriter pw,
|
|||
try {
|
||||
CountingOutputStream cnt = new CountingOutputStream(out);
|
||||
pw.writeBitmapIndex(cnt);
|
||||
pack.addFileExt(BITMAP_INDEX);
|
||||
pack.setFileSize(BITMAP_INDEX, cnt.getCount());
|
||||
} finally {
|
||||
out.close();
|
||||
|
|
|
@ -153,6 +153,7 @@ public void flush() throws IOException {
|
|||
throw new IOException();
|
||||
|
||||
byte[] packHash = packOut.writePackFooter();
|
||||
packDsc.addFileExt(PACK);
|
||||
packDsc.setFileSize(PACK, packOut.getCount());
|
||||
packOut.close();
|
||||
packOut = null;
|
||||
|
@ -261,6 +262,7 @@ PackIndex writePackIndex(DfsPackDescription pack, byte[] packHash,
|
|||
buf.writeTo(cnt, null);
|
||||
else
|
||||
index(cnt, packHash, list);
|
||||
pack.addFileExt(INDEX);
|
||||
pack.setFileSize(INDEX, cnt.getCount());
|
||||
} finally {
|
||||
os.close();
|
||||
|
|
|
@ -289,6 +289,7 @@ private static void writePack(DfsObjDatabase objdb,
|
|||
DfsOutputStream out = objdb.writeFile(pack, PACK);
|
||||
try {
|
||||
pw.writePack(pm, pm, out);
|
||||
pack.addFileExt(PACK);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
|
@ -301,6 +302,7 @@ private static void writeIndex(DfsObjDatabase objdb,
|
|||
try {
|
||||
CountingOutputStream cnt = new CountingOutputStream(out);
|
||||
pw.writeIndex(cnt);
|
||||
pack.addFileExt(INDEX);
|
||||
pack.setFileSize(INDEX, cnt.getCount());
|
||||
pack.setIndexVersion(pw.getIndexVersion());
|
||||
} finally {
|
||||
|
|
|
@ -148,6 +148,7 @@ public PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving)
|
|||
out = null;
|
||||
currBuf = null;
|
||||
readBlock = null;
|
||||
packDsc.addFileExt(PACK);
|
||||
packDsc.setFileSize(PACK, packEnd);
|
||||
|
||||
writePackIndex();
|
||||
|
|
Loading…
Reference in New Issue