]> source.dussan.org Git - jgit.git/commitdiff
Always add FileExt to DfsPackDescription 82/11482/1
authorShawn Pearce <sop@google.com>
Tue, 26 Mar 2013 17:57:19 +0000 (13:57 -0400)
committerShawn Pearce <sop@google.com>
Tue, 26 Mar 2013 18:00:57 +0000 (14:00 -0400)
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

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackParser.java

index a76e13bdfd7661a0ac46e3ee6c6d7c2d9c4aa668..a5a8c56d94e377feeb6809d55915edc7c9b3ccd2 100644 (file)
@@ -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();
index 9f5ddbdd84371e6e7b13245c78c814db286cd14f..76554c0ad8bb1e5d2c4fdc0294c9abc829405a64 100644 (file)
@@ -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();
index 926395c89037b76d63e97e6ee514353a6ed51333..ddd6ff7c0e63fdab783f6b1c2569d0d253fc04ab 100644 (file)
@@ -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 {
index f394348b21e0be9165dfa95751048edbbf0f6ed5..6430ea9c2a8960770dd4f6be46409b6160103d12 100644 (file)
@@ -148,6 +148,7 @@ public class DfsPackParser extends PackParser {
                        out = null;
                        currBuf = null;
                        readBlock = null;
+                       packDsc.addFileExt(PACK);
                        packDsc.setFileSize(PACK, packEnd);
 
                        writePackIndex();