Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'delta'

* delta: (103 commits)
  Discard the uncompressed delta as soon as its compressed
  Honor pack.windowlimit to cap memory usage during packing
  Honor pack.threads and perform delta search in parallel
  Cache small deltas during packing
  Implement delta generation during packing
  debug-show-packdelta:  Dump a pack delta to the console
  Initial pack format delta generator
  Add debugging toString() method to ObjectToPack
  Make ObjectToPack clearReuseAsIs signal available to subclasses
  Correctly classify the compressing objects phase
  Refactor ObjectToPack's delta depth setting
  Configure core.bigFileThreshold into PackWriter
  Add doNotDelta flag to ObjectToPack
  Add more configuration options to PackWriter
  Save object path hash codes during packing
  Add path hash code to ObjectWalk
  Add getObjectSize to ObjectReader
  Allow TemporaryBuffer.Heap to allocate smaller than 8 KiB
  Define a constant for 127 in DeltaEncoder
  Cap delta copy instructions at 64k
  ...

Conflicts:
	org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
	org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
	org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
	org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteTreeFilter.java

Change-Id: I7c7a05e443a48d32c836173a409ee7d340c70796
  • Loading branch information...
commit fa9b225e06f16ca7fd7ffca5689f4af0942a73e1 2 parents ab062ca + 12fe0f2
Shawn O. Pearce authored
Showing with 14,011 additions and 5,615 deletions.
  1. +1 −0  org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
  2. +2 −2 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java
  3. +27 −22 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
  4. +1 −1  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java
  5. +1 −1  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
  6. +6 −1 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
  7. +2 −0  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java
  8. +12 −2 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
  9. +3 −1 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/FileResolver.java
  10. +1 −0  org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
  11. +5 −4 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
  12. +5 −4 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
  13. +9 −8 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
  14. +8 −7 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
  15. +4 −2 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/util/HttpTestCase.java
  16. +1 −0  org.eclipse.jgit.iplog/META-INF/MANIFEST.MF
  17. +7 −11 org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
  18. +2 −2 org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
  19. +2 −0  org.eclipse.jgit.junit/META-INF/MANIFEST.MF
  20. +9 −8 org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
  21. +1 −1  org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
  22. +117 −66 org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
  23. +2 −0  org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
  24. +1 −0  org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
  25. +12 −9 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  26. +5 −3 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
  27. +3 −1 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
  28. +2 −2 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
  29. +8 −68 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
  30. +11 −7 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
  31. +2 −2 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
  32. +3 −6 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
  33. +15 −11 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
  34. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
  35. +1 −2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
  36. +2 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  37. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
  38. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
  39. +127 −0 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java
  40. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
  41. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
  42. +1 −1  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
  43. +3 −3 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
  44. +2 −0  org.eclipse.jgit.test/META-INF/MANIFEST.MF
  45. +1 −1  org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java
  46. +22 −22 org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
  47. +9 −9 org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
  48. +15 −1 org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/SimilarityIndexTest.java
  49. +10 −10 org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBasicTest.java
  50. +1 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderIteratorTest.java
  51. +10 −10 org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheBuilderTest.java
  52. +1 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheFindTest.java
  53. +8 −8 org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheIteratorTest.java
  54. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheLargePathTest.java
  55. +7 −7 org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheTreeTest.java
  56. +9 −9 org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReadTreeTest.java
  57. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
  58. +4 −3 org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryTestCase.java
  59. +1 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/SampleDataRepositoryTestCase.java
  60. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/WorkDirCheckout_ReadTreeTest.java
  61. +15 −13 org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
  62. +39 −36 org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
  63. +3 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java
  64. +19 −7 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/ConcurrentRepackTest.java
  65. +387 −0 org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java
  66. +3 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/PackIndexTestCase.java
  67. +2 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/PackIndexV1Test.java
  68. +2 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/PackIndexV2Test.java
  69. +3 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/PackReverseIndexTest.java
  70. +16 −7 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/PackWriterTest.java
  71. +5 −1 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/RefDirectoryTest.java
  72. +22 −9 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/RefUpdateTest.java
  73. +5 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/ReflogReaderTest.java
  74. +45 −41 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/RepositorySetupWorkDirTest.java
  75. +62 −44 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/T0003_Basic.java
  76. +8 −7 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/T0004_PackReader.java
  77. +534 −0 org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java
  78. +8 −11 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/WindowCacheGetTest.java
  79. +3 −1 org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/WindowCacheReconfigureTest.java
  80. +1 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/{lib → storage/file}/XInputStream.java
  81. +228 −0 org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaIndexTest.java
  82. +273 −0 org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
  83. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java
  84. +1 −1  org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/IndexPackTest.java
  85. +17 −17 org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackRefFilterTest.java
  86. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TransportTest.java
  87. +2 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
  88. +5 −2 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java
  89. +3 −1 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
  90. +8 −8 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
  91. +3 −3 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/PostOrderTreeWalkTest.java
  92. +17 −13 org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTestCase.java
  93. +3 −0  org.eclipse.jgit/META-INF/MANIFEST.MF
  94. +3 −1 org.eclipse.jgit/resources/org/eclipse/jgit/JGitText.properties
  95. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
  96. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java
  97. +56 −44 org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
  98. +36 −32 org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
  99. +47 −2 org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
  100. +14 −8 org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java
  101. +48 −4 org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java
  102. +7 −6 org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java
  103. +6 −50 org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
  104. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuildIterator.java
  105. +8 −13 org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
  106. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheIterator.java
  107. +4 −4 org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheTree.java
  108. +19 −19 org.eclipse.jgit/src/org/eclipse/jgit/{lib/IndexChangedEvent.java → errors/LargeObjectException.java}
  109. +59 −0 org.eclipse.jgit/src/org/eclipse/jgit/errors/NoWorkTreeException.java
  110. +61 −0 org.eclipse.jgit/src/org/eclipse/jgit/errors/StoredObjectRepresentationNotAvailableException.java
  111. +57 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/ConfigChangedEvent.java
  112. +10 −15 org.eclipse.jgit/src/org/eclipse/jgit/{lib/RepositoryAdapter.java → events/ConfigChangedListener.java}
  113. +57 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/IndexChangedEvent.java
  114. +6 −20 org.eclipse.jgit/src/org/eclipse/jgit/{lib/RepositoryListener.java → events/IndexChangedListener.java}
  115. +22 −18 org.eclipse.jgit/src/org/eclipse/jgit/{lib/RefsChangedEvent.java → events/ListenerHandle.java}
  116. +142 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerList.java
  117. +57 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/RefsChangedEvent.java
  118. +8 −23 org.eclipse.jgit/src/org/eclipse/jgit/{lib/RepositoryChangedEvent.java → events/RefsChangedListener.java}
  119. +95 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryEvent.java
  120. +49 −0 org.eclipse.jgit/src/org/eclipse/jgit/events/RepositoryListener.java
  121. +0 −142 org.eclipse.jgit/src/org/eclipse/jgit/lib/AlternateRepositoryDatabase.java
  122. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
  123. +616 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
  124. +4 −9 org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
  125. +0 −132 org.eclipse.jgit/src/org/eclipse/jgit/lib/CachedObjectDatabase.java
  126. +8 −1 org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java
  127. +14 −1 org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
  128. +0 −82 org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java
  129. +0 −118 org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java
  130. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/lib/FileTreeEntry.java
  131. +12 −12 org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
  132. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
  133. +68 −271 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDatabase.java
  134. +395 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
  135. +142 −9 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
  136. +185 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
  137. +220 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectStream.java
  138. +70 −261 org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java
  139. +0 −526 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
  140. +0 −1,040 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java
  141. +0 −188 org.eclipse.jgit/src/org/eclipse/jgit/lib/PackedObjectLoader.java
  142. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
  143. +12 −2 org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
  144. +1 −0  org.eclipse.jgit/src/org/eclipse/jgit/lib/RefWriter.java
  145. +359 −666 org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
  146. +74 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryBuilder.java
  147. +10 −3 org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java
  148. +0 −135 org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryConfig.java
  149. +8 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java
  150. +8 −3 org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java
  151. +111 −0 org.eclipse.jgit/src/org/eclipse/jgit/lib/ThreadSafeProgressMonitor.java
  152. +2 −4 org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
  153. +0 −223 org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java
  154. +0 −110 org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java
  155. +20 −15 org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java
  156. +6 −3 org.eclipse.jgit/src/org/eclipse/jgit/merge/StrategySimpleTwoWayInCore.java
  157. +14 −9 org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
  158. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
  159. +31 −6 org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
  160. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/revwalk/PendingGenerator.java
  161. +2 −1  org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
  162. +1 −8 org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObject.java
  163. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevTag.java
  164. +67 −29 org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
  165. +4 −4 org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RewriteTreeFilter.java
  166. +21 −24 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/ByteArrayWindow.java
  167. +6 −32 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/ByteBufferWindow.java
  168. +4 −63 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/ByteWindow.java
  169. +115 −14 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/CachedObjectDirectory.java
  170. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/FileBasedConfig.java
  171. +271 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileObjectDatabase.java
  172. +328 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepository.java
  173. +90 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileRepositoryBuilder.java
  174. +230 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LargePackedDeltaObject.java
  175. +72 −22 .../src/org/eclipse/jgit/{lib/DeltaRefPackedObjectLoader.java → storage/file/LargePackedWholeObject.java}
  176. +58 −47 ...se.jgit/src/org/eclipse/jgit/{lib/PackOutputStream.java → storage/file/LocalObjectRepresentation.java}
  177. +78 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/LocalObjectToPack.java
  178. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/LockFile.java
  179. +177 −55 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/ObjectDirectory.java
  180. +182 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/ObjectDirectoryInserter.java
  181. +920 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
  182. +4 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndex.java
  183. +4 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndexV1.java
  184. +4 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndexV2.java
  185. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndexWriter.java
  186. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndexWriterV1.java
  187. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackIndexWriterV2.java
  188. +85 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackInputStream.java
  189. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackLock.java
  190. +3 −2 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/PackReverseIndex.java
  191. +37 −19 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/RefDirectory.java
  192. +7 −2 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/RefDirectoryRename.java
  193. +5 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/RefDirectoryUpdate.java
  194. +5 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/ReflogReader.java
  195. +413 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/file/UnpackedObject.java
  196. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/UnpackedObjectCache.java
  197. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/WindowCache.java
  198. +3 −1 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/WindowCacheConfig.java
  199. +109 −32 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/file}/WindowCursor.java
  200. +146 −3 org.eclipse.jgit/src/org/eclipse/jgit/{lib → storage/pack}/BinaryDelta.java
  201. +134 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaCache.java
  202. +294 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaEncoder.java
  203. +586 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndex.java
  204. +130 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaIndexScanner.java
  205. +341 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java
  206. +511 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindow.java
  207. +80 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaWindowEntry.java
  208. +136 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectReuseAsIs.java
  209. +320 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ObjectToPack.java
  210. +93 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
  211. +213 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackOutputStream.java
  212. +1,442 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java
  213. +90 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/StoredObjectRepresentation.java
  214. +86 −0 org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/ThreadSafeDeltaCache.java
  215. +7 −1 org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
  216. +24 −19 org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java
  217. +50 −42 org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
  218. +37 −32 org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
  219. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchConnection.java
  220. +29 −18 org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
  221. +27 −13 org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java
  222. +29 −23 org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java
  223. +4 −5 org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
  224. +8 −18 org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java
  225. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
  226. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
  227. +28 −17 org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
  228. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
  229. +3 −2 org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java
  230. +31 −24 org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
  231. +70 −76 org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
  232. +6 −4 org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
  233. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java
  234. +29 −13 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
  235. +26 −52 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java
  236. +2 −2 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/EmptyTreeIterator.java
  237. +3 −2 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
  238. +12 −1 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/NameConflictTreeWalk.java
  239. +37 −19 org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
  240. +3 −8 org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
  241. +14 −0 org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java
  242. +1 −1  org.eclipse.jgit/src/org/eclipse/jgit/util/SystemReader.java
  243. +43 −9 org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java
1  org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
View
@@ -17,6 +17,7 @@ Import-Package: javax.servlet;version="[2.5.0,3.0.0)",
org.eclipse.jgit.lib;version="[0.9.0,0.10.0)",
org.eclipse.jgit.nls;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.util;version="[0.9.0,0.10.0)",
org.eclipse.jgit.util.io;version="[0.9.0,0.10.0)"
4 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoPacksServlet.java
View
@@ -53,8 +53,8 @@
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jgit.lib.ObjectDatabase;
-import org.eclipse.jgit.lib.ObjectDirectory;
-import org.eclipse.jgit.lib.PackFile;
+import org.eclipse.jgit.storage.file.ObjectDirectory;
+import org.eclipse.jgit.storage.file.PackFile;
/** Sends the current list of pack files, sorted most recent first. */
class InfoPacksServlet extends HttpServlet {
49 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/InfoRefsServlet.java
View
@@ -74,30 +74,35 @@ public void doGet(final HttpServletRequest req,
final Repository db = getRepository(req);
final RevWalk walk = new RevWalk(db);
- final RevFlag ADVERTISED = walk.newFlag("ADVERTISED");
+ try {
+ final RevFlag ADVERTISED = walk.newFlag("ADVERTISED");
- final OutputStreamWriter out = new OutputStreamWriter(
- new SmartOutputStream(req, rsp), Constants.CHARSET);
- final RefAdvertiser adv = new RefAdvertiser() {
- @Override
- protected void writeOne(final CharSequence line) throws IOException {
- // Whoever decided that info/refs should use a different
- // delimiter than the native git:// protocol shouldn't
- // be allowed to design this sort of stuff. :-(
- out.append(line.toString().replace(' ', '\t'));
- }
+ final OutputStreamWriter out = new OutputStreamWriter(
+ new SmartOutputStream(req, rsp), Constants.CHARSET);
+ final RefAdvertiser adv = new RefAdvertiser() {
+ @Override
+ protected void writeOne(final CharSequence line)
+ throws IOException {
+ // Whoever decided that info/refs should use a different
+ // delimiter than the native git:// protocol shouldn't
+ // be allowed to design this sort of stuff. :-(
+ out.append(line.toString().replace(' ', '\t'));
+ }
- @Override
- protected void end() {
- // No end marker required for info/refs format.
- }
- };
- adv.init(walk, ADVERTISED);
- adv.setDerefTags(true);
+ @Override
+ protected void end() {
+ // No end marker required for info/refs format.
+ }
+ };
+ adv.init(walk, ADVERTISED);
+ adv.setDerefTags(true);
- Map<String, Ref> refs = db.getAllRefs();
- refs.remove(Constants.HEAD);
- adv.send(refs);
- out.close();
+ Map<String, Ref> refs = db.getAllRefs();
+ refs.remove(Constants.HEAD);
+ adv.send(refs);
+ out.close();
+ } finally {
+ walk.release();
+ }
}
}
2  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/IsLocalFilter.java
View
@@ -56,8 +56,8 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.jgit.lib.ObjectDirectory;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.storage.file.ObjectDirectory;
/**
* Requires the target {@link Repository} to be available via local filesystem.
2  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ObjectFileServlet.java
View
@@ -60,8 +60,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.eclipse.jgit.lib.ObjectDirectory;
import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.storage.file.ObjectDirectory;
/** Sends any object from {@code GIT_DIR/objects/??/0 38}, or any pack file. */
abstract class ObjectFileServlet extends HttpServlet {
7 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ReceivePackServlet.java
View
@@ -83,7 +83,12 @@
protected void advertise(HttpServletRequest req, Repository db,
PacketLineOutRefAdvertiser pck) throws IOException,
ServiceNotEnabledException, ServiceNotAuthorizedException {
- receivePackFactory.create(req, db).sendAdvertisedRefs(pck);
+ ReceivePack rp = receivePackFactory.create(req, db);
+ try {
+ rp.sendAdvertisedRefs(pck);
+ } finally {
+ rp.getRevWalk().release();
+ }
}
}
2  org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/TextFileServlet.java
View
@@ -80,6 +80,8 @@ public void doGet(final HttpServletRequest req,
private byte[] read(final HttpServletRequest req) throws IOException {
final File gitdir = getRepository(req).getDirectory();
+ if (gitdir == null)
+ throw new FileNotFoundException(fileName);
return IO.readFully(new File(gitdir, fileName));
}
}
14 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
View
@@ -83,7 +83,12 @@
protected void advertise(HttpServletRequest req, Repository db,
PacketLineOutRefAdvertiser pck) throws IOException,
ServiceNotEnabledException, ServiceNotAuthorizedException {
- uploadPackFactory.create(req, db).sendAdvertisedRefs(pck);
+ UploadPack up = uploadPackFactory.create(req, db);
+ try {
+ up.sendAdvertisedRefs(pck);
+ } finally {
+ up.getRevWalk().release();
+ }
}
}
@@ -107,7 +112,12 @@ public void doPost(final HttpServletRequest req,
up.setBiDirectionalPipe(false);
rsp.setContentType(RSP_TYPE);
- final SmartOutputStream out = new SmartOutputStream(req, rsp);
+ final SmartOutputStream out = new SmartOutputStream(req, rsp) {
+ @Override
+ public void flush() throws IOException {
+ doFlush();
+ }
+ };
up.upload(getInputStream(req), out, null);
out.close();
4 org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/FileResolver.java
View
@@ -138,8 +138,10 @@ protected boolean isExportOk(HttpServletRequest req, String repositoryName,
Repository db) throws IOException {
if (isExportAll())
return true;
- else
+ else if (db.getDirectory() != null)
return new File(db.getDirectory(), "git-daemon-export-ok").exists();
+ else
+ return false;
}
private static boolean isUnreasonableName(final String name) {
1  org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
View
@@ -29,5 +29,6 @@ Import-Package: javax.servlet;version="[2.5.0,3.0.0)",
org.eclipse.jgit.junit;version="[0.9.0,0.10.0)",
org.eclipse.jgit.lib;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.util;version="[0.9.0,0.10.0)"
9 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AdvertiseErrorTest.java
View
@@ -62,23 +62,24 @@
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.RepositoryConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.ReceivePack;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
public class AdvertiseErrorTest extends HttpTestCase {
- private Repository remoteRepository;
+ private FileRepository remoteRepository;
private URIish remoteURI;
protected void setUp() throws Exception {
super.setUp();
- final TestRepository src = createTestRepository();
+ final TestRepository<FileRepository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@@ -114,7 +115,7 @@ public ReceivePack create(HttpServletRequest req, Repository db)
remoteRepository = src.getRepository();
remoteURI = toURIish(app, srcName);
- RepositoryConfig cfg = remoteRepository.getConfig();
+ FileBasedConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}
9 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java
View
@@ -64,9 +64,10 @@
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.RepositoryConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.PreReceiveHook;
import org.eclipse.jgit.transport.PushResult;
import org.eclipse.jgit.transport.ReceiveCommand;
@@ -76,14 +77,14 @@
import org.eclipse.jgit.transport.URIish;
public class HookMessageTest extends HttpTestCase {
- private Repository remoteRepository;
+ private FileRepository remoteRepository;
private URIish remoteURI;
protected void setUp() throws Exception {
super.setUp();
- final TestRepository src = createTestRepository();
+ final TestRepository<FileRepository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@@ -124,7 +125,7 @@ public void onPreReceive(ReceivePack rp,
remoteRepository = src.getRepository();
remoteURI = toURIish(app, srcName);
- RepositoryConfig cfg = remoteRepository.getConfig();
+ FileBasedConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}
17 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java
View
@@ -66,12 +66,13 @@
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
public class HttpClientTests extends HttpTestCase {
- private TestRepository remoteRepository;
+ private TestRepository<FileRepository> remoteRepository;
private URIish dumbAuthNoneURI;
@@ -95,7 +96,7 @@ protected void setUp() throws Exception {
server.setUp();
- final String srcName = nameOf(remoteRepository);
+ final String srcName = nameOf(remoteRepository.getRepository());
dumbAuthNoneURI = toURIish(dNone, srcName);
dumbAuthBasicURI = toURIish(dBasic, srcName);
@@ -119,10 +120,10 @@ private ServletContextHandler smart(final String path) {
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException,
ServiceNotEnabledException {
- if (!name.equals(nameOf(remoteRepository)))
+ final FileRepository db = remoteRepository.getRepository();
+ if (!name.equals(nameOf(db)))
throw new RepositoryNotFoundException(name);
- final Repository db = remoteRepository.getRepository();
db.incrementOpen();
return db;
}
@@ -133,8 +134,8 @@ public Repository open(HttpServletRequest req, String name)
return ctx;
}
- private static String nameOf(final TestRepository db) {
- return db.getRepository().getDirectory().getName();
+ private static String nameOf(final FileRepository db) {
+ return db.getDirectory().getName();
}
public void testRepositoryNotFound_Dumb() throws Exception {
@@ -198,7 +199,7 @@ public void testListRemote_Dumb_DetachedHEAD() throws Exception {
}
public void testListRemote_Dumb_NoHEAD() throws Exception {
- Repository src = remoteRepository.getRepository();
+ FileRepository src = remoteRepository.getRepository();
File headref = new File(src.getDirectory(), Constants.HEAD);
assertTrue("HEAD used to be present", headref.delete());
assertFalse("HEAD is gone", headref.exists());
@@ -306,7 +307,7 @@ public void testListRemote_Smart_UploadPackNeedsAuth() throws Exception {
}
public void testListRemote_Smart_UploadPackDisabled() throws Exception {
- Repository src = remoteRepository.getRepository();
+ FileRepository src = remoteRepository.getRepository();
src.getConfig().setBoolean("http", null, "uploadpack", false);
src.getConfig().save();
15 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
View
@@ -79,11 +79,12 @@
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.ReflogReader;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.RepositoryConfig;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.ReflogReader;
import org.eclipse.jgit.transport.FetchConnection;
import org.eclipse.jgit.transport.HttpTransport;
import org.eclipse.jgit.transport.RemoteRefUpdate;
@@ -94,7 +95,7 @@
public class SmartClientSmartServerTest extends HttpTestCase {
private static final String HDR_TRANSFER_ENCODING = "Transfer-Encoding";
- private Repository remoteRepository;
+ private FileRepository remoteRepository;
private URIish remoteURI;
@@ -107,7 +108,7 @@
protected void setUp() throws Exception {
super.setUp();
- final TestRepository src = createTestRepository();
+ final TestRepository<FileRepository> src = createTestRepository();
final String srcName = src.getRepository().getDirectory().getName();
ServletContextHandler app = server.addContext("/git");
@@ -489,10 +490,10 @@ public void testPush_CreateBranch() throws Exception {
}
public void testPush_ChunkedEncoding() throws Exception {
- final TestRepository src = createTestRepository();
+ final TestRepository<FileRepository> src = createTestRepository();
final RevBlob Q_bin = src.blob(new TestRng("Q").nextBytes(128 * 1024));
final RevCommit Q = src.commit().add("Q", Q_bin).create();
- final Repository db = src.getRepository();
+ final FileRepository db = src.getRepository();
final String dstName = Constants.R_HEADS + "new.branch";
Transport t;
@@ -547,7 +548,7 @@ public void testPush_ChunkedEncoding() throws Exception {
}
private void enableReceivePack() throws IOException {
- final RepositoryConfig cfg = remoteRepository.getConfig();
+ final FileBasedConfig cfg = remoteRepository.getConfig();
cfg.setBoolean("http", null, "receivepack", true);
cfg.save();
}
6 org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/util/HttpTestCase.java
View
@@ -61,6 +61,7 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevObject;
+import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteRefUpdate;
import org.eclipse.jgit.transport.URIish;
@@ -82,8 +83,9 @@ protected void tearDown() throws Exception {
super.tearDown();
}
- protected TestRepository createTestRepository() throws Exception {
- return new TestRepository(createBareRepository());
+ protected TestRepository<FileRepository> createTestRepository()
+ throws IOException {
+ return new TestRepository<FileRepository>(createBareRepository());
}
protected URIish toURIish(String path) throws URISyntaxException {
1  org.eclipse.jgit.iplog/META-INF/MANIFEST.MF
View
@@ -15,6 +15,7 @@ Import-Package: org.eclipse.jgit.diff;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revplot;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk.filter;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk.filter;version="[0.9.0,0.10.0)",
18 org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
View
@@ -78,15 +78,13 @@
import org.eclipse.jgit.diff.MyersDiff;
import org.eclipse.jgit.diff.RawText;
import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.iplog.Committer.ActiveRange;
import org.eclipse.jgit.lib.BlobBasedConfig;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.MutableObjectId;
-import org.eclipse.jgit.lib.ObjectLoader;
+import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.lib.WindowCursor;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
@@ -144,7 +142,7 @@
private NameConflictTreeWalk tw;
- private final WindowCursor curs = new WindowCursor();
+ private ObjectReader curs;
private final MutableObjectId idbuf = new MutableObjectId();
@@ -184,8 +182,9 @@ public void scan(Repository repo, RevCommit startCommit, String version)
throws IOException, ConfigInvalidException {
try {
db = repo;
- rw = new RevWalk(db);
- tw = new NameConflictTreeWalk(db);
+ curs = db.newObjectReader();
+ rw = new RevWalk(curs);
+ tw = new NameConflictTreeWalk(curs);
RevCommit c = rw.parseCommit(startCommit);
@@ -194,7 +193,7 @@ public void scan(Repository repo, RevCommit startCommit, String version)
scanProjectCommits(meta.getProjects().get(0), c);
commits.add(c);
} finally {
- WindowCursor.release(curs);
+ curs.release();
db = null;
rw = null;
tw = null;
@@ -417,10 +416,7 @@ private void scanProjectCommits(Project proj, RevCommit start)
private byte[] openBlob(int side) throws IOException {
tw.getObjectId(idbuf, side);
- ObjectLoader ldr = db.openObject(curs, idbuf);
- if (ldr == null)
- throw new MissingObjectException(idbuf.copy(), Constants.OBJ_BLOB);
- return ldr.getCachedBytes();
+ return curs.open(idbuf, Constants.OBJ_BLOB).getCachedBytes();
}
/**
4 org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java
View
@@ -58,9 +58,9 @@
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileBasedConfig;
-import org.eclipse.jgit.lib.LockFile;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.LockFile;
/**
* Manages the {@code .eclipse_iplog} file in a project.
2  org.eclipse.jgit.junit/META-INF/MANIFEST.MF
View
@@ -18,6 +18,8 @@ Import-Package: junit.framework;version="[3.8.2,4.0.0)",
org.eclipse.jgit.revplot;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk.filter;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.pack;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk.filter;version="[0.9.0,0.10.0)",
17 org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java
View
@@ -62,12 +62,13 @@
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileBasedConfig;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
-import org.eclipse.jgit.lib.WindowCache;
-import org.eclipse.jgit.lib.WindowCacheConfig;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.WindowCache;
+import org.eclipse.jgit.storage.file.WindowCacheConfig;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.SystemReader;
@@ -259,7 +260,7 @@ private static void reportDeleteFailure(final String testName,
* @throws IOException
* the repository could not be created in the temporary area
*/
- protected Repository createBareRepository() throws IOException {
+ protected FileRepository createBareRepository() throws IOException {
return createRepository(true /* bare */);
}
@@ -270,7 +271,7 @@ protected Repository createBareRepository() throws IOException {
* @throws IOException
* the repository could not be created in the temporary area
*/
- protected Repository createWorkRepository() throws IOException {
+ protected FileRepository createWorkRepository() throws IOException {
return createRepository(false /* not bare */);
}
@@ -284,11 +285,11 @@ protected Repository createWorkRepository() throws IOException {
* @throws IOException
* the repository could not be created in the temporary area
*/
- private Repository createRepository(boolean bare) throws IOException {
+ private FileRepository createRepository(boolean bare) throws IOException {
String uniqueId = System.currentTimeMillis() + "_" + (testCount++);
String gitdirName = "test" + uniqueId + (bare ? "" : "/") + Constants.DOT_GIT;
File gitdir = new File(trash, gitdirName).getCanonicalFile();
- Repository db = new Repository(gitdir);
+ FileRepository db = new FileRepository(gitdir);
assertFalse(gitdir.exists());
db.create();
@@ -323,7 +324,7 @@ protected int runHook(final Repository db, final File hook,
putPersonIdent(env, "AUTHOR", author);
putPersonIdent(env, "COMMITTER", committer);
- final File cwd = db.getWorkDir();
+ final File cwd = db.getWorkTree();
final Process p = Runtime.getRuntime().exec(argv, toEnvArray(env), cwd);
p.getOutputStream().close();
p.getErrorStream().close();
2  org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
View
@@ -52,7 +52,7 @@
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.FileBasedConfig;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.eclipse.jgit.util.SystemReader;
183 org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
View
@@ -73,22 +73,16 @@
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
-import org.eclipse.jgit.lib.LockFile;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectChecker;
-import org.eclipse.jgit.lib.ObjectDatabase;
-import org.eclipse.jgit.lib.ObjectDirectory;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectWriter;
-import org.eclipse.jgit.lib.PackFile;
-import org.eclipse.jgit.lib.PackWriter;
+import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.RefWriter;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.Tag;
-import org.eclipse.jgit.lib.PackIndex.MutableEntry;
import org.eclipse.jgit.revwalk.ObjectWalk;
import org.eclipse.jgit.revwalk.RevBlob;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -96,11 +90,22 @@
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.storage.file.FileRepository;
+import org.eclipse.jgit.storage.file.LockFile;
+import org.eclipse.jgit.storage.file.ObjectDirectory;
+import org.eclipse.jgit.storage.file.PackFile;
+import org.eclipse.jgit.storage.file.PackIndex.MutableEntry;
+import org.eclipse.jgit.storage.pack.PackWriter;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
-/** Wrapper to make creating test data easier. */
-public class TestRepository {
+/**
+ * Wrapper to make creating test data easier.
+ *
+ * @param <R>
+ * type of Repository the test data is stored on.
+ */
+public class TestRepository<R extends Repository> {
private static final PersonIdent author;
private static final PersonIdent committer;
@@ -119,11 +124,11 @@
committer = new PersonIdent(cn, ce, now, tz);
}
- private final Repository db;
+ private final R db;
private final RevWalk pool;
- private final ObjectWriter writer;
+ private final ObjectInserter inserter;
private long now;
@@ -132,9 +137,9 @@
*
* @param db
* the test repository to write into.
- * @throws Exception
+ * @throws IOException
*/
- public TestRepository(Repository db) throws Exception {
+ public TestRepository(R db) throws IOException {
this(db, new RevWalk(db));
}
@@ -145,17 +150,17 @@ public TestRepository(Repository db) throws Exception {
* the test repository to write into.
* @param rw
* the RevObject pool to use for object lookup.
- * @throws Exception
+ * @throws IOException
*/
- public TestRepository(Repository db, RevWalk rw) throws Exception {
+ public TestRepository(R db, RevWalk rw) throws IOException {
this.db = db;
this.pool = rw;
- this.writer = new ObjectWriter(db);
+ this.inserter = db.newObjectInserter();
this.now = 1236977987000L;
}
/** @return the repository this helper class operates against. */
- public Repository getRepository() {
+ public R getRepository() {
return db;
}
@@ -200,7 +205,14 @@ public RevBlob blob(final String content) throws Exception {
* @throws Exception
*/
public RevBlob blob(final byte[] content) throws Exception {
- return pool.lookupBlob(writer.writeBlob(content));
+ ObjectId id;
+ try {
+ id = inserter.insert(Constants.OBJ_BLOB, content);
+ inserter.flush();
+ } finally {
+ inserter.release();
+ }
+ return pool.lookupBlob(id);
}
/**
@@ -236,7 +248,14 @@ public RevTree tree(final DirCacheEntry... entries) throws Exception {
for (final DirCacheEntry e : entries)
b.add(e);
b.finish();
- return pool.lookupTree(dc.writeTree(writer));
+ ObjectId root;
+ try {
+ root = dc.writeTree(inserter);
+ inserter.flush();
+ } finally {
+ inserter.release();
+ }
+ return pool.lookupTree(root);
}
/**
@@ -253,7 +272,7 @@ public RevTree tree(final DirCacheEntry... entries) throws Exception {
*/
public RevObject get(final RevTree tree, final String path)
throws AssertionFailedError, Exception {
- final TreeWalk tw = new TreeWalk(db);
+ final TreeWalk tw = new TreeWalk(pool.getObjectReader());
tw.setFilter(PathFilterGroup.createFromStrings(Collections
.singleton(path)));
tw.reset(tree);
@@ -346,7 +365,14 @@ public RevCommit commit(final int secDelta, final RevTree tree,
c.setAuthor(new PersonIdent(author, new Date(now)));
c.setCommitter(new PersonIdent(committer, new Date(now)));
c.setMessage("");
- return pool.lookupCommit(writer.writeCommit(c));
+ ObjectId id;
+ try {
+ id = inserter.insert(Constants.OBJ_COMMIT, inserter.format(c));
+ inserter.flush();
+ } finally {
+ inserter.release();
+ }
+ return pool.lookupCommit(id);
}
/** @return a new commit builder. */
@@ -377,7 +403,14 @@ public RevTag tag(final String name, final RevObject dst) throws Exception {
t.setTag(name);
t.setTagger(new PersonIdent(committer, new Date(now)));
t.setMessage("");
- return (RevTag) pool.lookupAny(writer.writeTag(t), Constants.OBJ_TAG);
+ ObjectId id;
+ try {
+ id = inserter.insert(Constants.OBJ_TAG, inserter.format(t));
+ inserter.flush();
+ } finally {
+ inserter.release();
+ }
+ return (RevTag) pool.lookupAny(id, Constants.OBJ_TAG);
}
/**
@@ -443,25 +476,27 @@ public RevCommit update(String ref, CommitBuilder to) throws Exception {
* @throws Exception
*/
public void updateServerInfo() throws Exception {
- final ObjectDatabase odb = db.getObjectDatabase();
- if (odb instanceof ObjectDirectory) {
- RefWriter rw = new RefWriter(db.getAllRefs().values()) {
+ if (db instanceof FileRepository) {
+ final FileRepository fr = (FileRepository) db;
+ RefWriter rw = new RefWriter(fr.getAllRefs().values()) {
@Override
protected void writeFile(final String name, final byte[] bin)
throws IOException {
- TestRepository.this.writeFile(name, bin);
+ File path = new File(fr.getDirectory(), name);
+ TestRepository.this.writeFile(path, bin);
}
};
rw.writePackedRefs();
rw.writeInfoRefs();
final StringBuilder w = new StringBuilder();
- for (PackFile p : ((ObjectDirectory) odb).getPacks()) {
+ for (PackFile p : fr.getObjectDatabase().getPacks()) {
w.append("P ");
w.append(p.getPackFile().getName());
w.append('\n');
}
- writeFile("objects/info/packs", Constants.encodeASCII(w.toString()));
+ writeFile(new File(new File(fr.getObjectDatabase().getDirectory(),
+ "info"), "packs"), Constants.encodeASCII(w.toString()));
}
}
@@ -528,7 +563,7 @@ public void fsck(RevObject... tips) throws MissingObjectException,
if (o == null)
break;
- final byte[] bin = db.openObject(o).getCachedBytes();
+ final byte[] bin = db.open(o, o.getType()).getCachedBytes();
oc.checkCommit(bin);
assertHash(o, bin);
}
@@ -538,7 +573,7 @@ public void fsck(RevObject... tips) throws MissingObjectException,
if (o == null)
break;
- final byte[] bin = db.openObject(o).getCachedBytes();
+ final byte[] bin = db.open(o, o.getType()).getCachedBytes();
oc.check(o.getType(), bin);
assertHash(o, bin);
}
@@ -563,38 +598,46 @@ private static void assertHash(RevObject id, byte[] bin) {
* @throws Exception
*/
public void packAndPrune() throws Exception {
- final ObjectDirectory odb = (ObjectDirectory) db.getObjectDatabase();
- final PackWriter pw = new PackWriter(db, NullProgressMonitor.INSTANCE);
-
- Set<ObjectId> all = new HashSet<ObjectId>();
- for (Ref r : db.getAllRefs().values())
- all.add(r.getObjectId());
- pw.preparePack(all, Collections.<ObjectId> emptySet());
-
- final ObjectId name = pw.computeName();
- OutputStream out;
-
- final File pack = nameFor(odb, name, ".pack");
- out = new BufferedOutputStream(new FileOutputStream(pack));
- try {
- pw.writePack(out);
- } finally {
- out.close();
- }
- pack.setReadOnly();
+ if (db.getObjectDatabase() instanceof ObjectDirectory) {
+ ObjectDirectory odb = (ObjectDirectory) db.getObjectDatabase();
+ NullProgressMonitor m = NullProgressMonitor.INSTANCE;
+
+ final File pack, idx;
+ PackWriter pw = new PackWriter(db);
+ try {
+ Set<ObjectId> all = new HashSet<ObjectId>();
+ for (Ref r : db.getAllRefs().values())
+ all.add(r.getObjectId());
+ pw.preparePack(m, all, Collections.<ObjectId> emptySet());
+
+ final ObjectId name = pw.computeName();
+ OutputStream out;
+
+ pack = nameFor(odb, name, ".pack");
+ out = new BufferedOutputStream(new FileOutputStream(pack));
+ try {
+ pw.writePack(m, m, out);
+ } finally {
+ out.close();
+ }
+ pack.setReadOnly();
+
+ idx = nameFor(odb, name, ".idx");
+ out = new BufferedOutputStream(new FileOutputStream(idx));
+ try {
+ pw.writeIndex(out);
+ } finally {
+ out.close();
+ }
+ idx.setReadOnly();
+ } finally {
+ pw.release();
+ }
- final File idx = nameFor(odb, name, ".idx");
- out = new BufferedOutputStream(new FileOutputStream(idx));
- try {
- pw.writeIndex(out);
- } finally {
- out.close();
+ odb.openPack(pack, idx);
+ updateServerInfo();
+ prunePacked(odb);
}
- idx.setReadOnly();
-
- odb.openPack(pack, idx);
- updateServerInfo();
- prunePacked(odb);
}
private void prunePacked(ObjectDirectory odb) {
@@ -609,9 +652,8 @@ private static File nameFor(ObjectDirectory odb, ObjectId name, String t) {
return new File(packdir, "pack-" + name.name() + t);
}
- private void writeFile(final String name, final byte[] bin)
- throws IOException, ObjectWritingException {
- final File p = new File(db.getDirectory(), name);
+ private void writeFile(final File p, final byte[] bin) throws IOException,
+ ObjectWritingException {
final LockFile lck = new LockFile(p);
if (!lck.lock())
throw new ObjectWritingException("Can't write " + p);
@@ -711,7 +753,8 @@ public CommitBuilder parent(RevCommit p) throws Exception {
if (parents.isEmpty()) {
DirCacheBuilder b = tree.builder();
parseBody(p);
- b.addTree(new byte[0], DirCacheEntry.STAGE_0, db, p.getTree());
+ b.addTree(new byte[0], DirCacheEntry.STAGE_0, pool
+ .getObjectReader(), p.getTree());
b.finish();
}
parents.add(p);
@@ -769,13 +812,21 @@ public RevCommit create() throws Exception {
TestRepository.this.tick(tick);
final Commit c = new Commit(db);
- c.setTreeId(pool.lookupTree(tree.writeTree(writer)));
c.setParentIds(parents.toArray(new RevCommit[parents.size()]));
c.setAuthor(new PersonIdent(author, new Date(now)));
c.setCommitter(new PersonIdent(committer, new Date(now)));
c.setMessage(message);
- self = pool.lookupCommit(writer.writeCommit(c));
+ ObjectId commitId;
+ try {
+ c.setTreeId(tree.writeTree(inserter));
+ commitId = inserter.insert(Constants.OBJ_COMMIT, inserter
+ .format(c));
+ inserter.flush();
+ } finally {
+ inserter.release();
+ }
+ self = pool.lookupCommit(commitId);
if (branch != null)
branch.update(self);
2  org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
View
@@ -17,6 +17,8 @@ Import-Package: org.eclipse.jgit.api;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revplot;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk.filter;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.pack;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk.filter;version="[0.9.0,0.10.0)",
1  org.eclipse.jgit.pgm/META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
View
@@ -30,6 +30,7 @@ org.eclipse.jgit.pgm.debug.RebuildCommitGraph
org.eclipse.jgit.pgm.debug.ShowCacheTree
org.eclipse.jgit.pgm.debug.ShowCommands
org.eclipse.jgit.pgm.debug.ShowDirCache
+org.eclipse.jgit.pgm.debug.ShowPackDelta
org.eclipse.jgit.pgm.debug.WriteDirCache
org.eclipse.jgit.pgm.eclipse.Iplog
21 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
View
@@ -61,10 +61,10 @@
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefComparator;
import org.eclipse.jgit.lib.RefUpdate;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.TextProgressMonitor;
import org.eclipse.jgit.lib.Tree;
import org.eclipse.jgit.lib.WorkDirCheckout;
+import org.eclipse.jgit.storage.file.FileRepository;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
@@ -82,6 +82,8 @@
@Argument(index = 1, metaVar = "metaVar_directory")
private String localName;
+ private FileRepository dst;
+
@Override
protected final boolean requiresRepository() {
return false;
@@ -103,10 +105,11 @@ protected void run() throws Exception {
if (gitdir == null)
gitdir = new File(localName, Constants.DOT_GIT);
- db = new Repository(gitdir);
- db.create();
- db.getConfig().setBoolean("core", null, "bare", false);
- db.getConfig().save();
+ dst = new FileRepository(gitdir);
+ dst.create();
+ dst.getConfig().setBoolean("core", null, "bare", false);
+ dst.getConfig().save();
+ db = dst;
out.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath());
out.println();
@@ -120,13 +123,13 @@ protected void run() throws Exception {
private void saveRemote(final URIish uri) throws URISyntaxException,
IOException {
- final RemoteConfig rc = new RemoteConfig(db.getConfig(), remoteName);
+ final RemoteConfig rc = new RemoteConfig(dst.getConfig(), remoteName);
rc.addURI(uri);
rc.addFetchRefSpec(new RefSpec().setForceUpdate(true)
.setSourceDestination(Constants.R_HEADS + "*",
Constants.R_REMOTES + remoteName + "/*"));
- rc.update(db.getConfig());
- db.getConfig().save();
+ rc.update(dst.getConfig());
+ dst.getConfig().save();
}
private FetchResult runFetch() throws NotSupportedException,
@@ -180,7 +183,7 @@ private void doCheckout(final Ref branch) throws IOException {
final Tree tree = commit.getTree();
final WorkDirCheckout co;
- co = new WorkDirCheckout(db, db.getWorkDir(), index, tree);
+ co = new WorkDirCheckout(db, db.getWorkTree(), index, tree);
co.checkout();
index.write();
}
8 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Glog.java
View
@@ -125,10 +125,12 @@ protected RevWalk createWalk() {
}
private String repoName() {
- final File f = db.getDirectory();
- String n = f.getName();
+ final File gitDir = db.getDirectory();
+ if (gitDir == null)
+ return db.toString();
+ String n = gitDir.getName();
if (Constants.DOT_GIT.equals(n))
- n = f.getParentFile().getName();
+ n = gitDir.getParentFile().getName();
return n;
}
}
4 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
View
@@ -49,6 +49,7 @@
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
+import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.TextProgressMonitor;
class IndexPack extends TextBuiltin {
@@ -64,7 +65,8 @@
@Override
protected void run() throws Exception {
if (indexVersion == -1)
- indexVersion = db.getConfig().getCore().getPackIndexVersion();
+ indexVersion = db.getConfig().get(CoreConfig.KEY)
+ .getPackIndexVersion();
final BufferedInputStream in;
final org.eclipse.jgit.transport.IndexPack ip;
in = new BufferedInputStream(System.in);
4 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Init.java
View
@@ -50,7 +50,7 @@
import org.kohsuke.args4j.Option;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.storage.file.FileRepository;
@Command(common = true, usage = "usage_CreateAnEmptyGitRepository")
class Init extends TextBuiltin {
@@ -66,7 +66,7 @@ protected final boolean requiresRepository() {
protected void run() throws Exception {
if (gitdir == null)
gitdir = new File(bare ? "." : Constants.DOT_GIT);
- db = new Repository(gitdir);
+ db = new FileRepository(gitdir);
db.create(bare);
out.println(MessageFormat.format(CLIText.get().initializedEmptyGitRepositoryIn, gitdir.getAbsolutePath()));
}
76 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
View
@@ -51,20 +51,15 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jgit.awtui.AwtAuthenticator;
import org.eclipse.jgit.awtui.AwtSshSessionFactory;
import org.eclipse.jgit.errors.TransportException;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.RepositoryBuilder;
import org.eclipse.jgit.pgm.opt.CmdLineParser;
import org.eclipse.jgit.pgm.opt.SubcommandHandler;
import org.eclipse.jgit.util.CachedAuthenticator;
-import org.eclipse.jgit.util.SystemReader;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.ExampleMode;
@@ -168,51 +163,17 @@ private void execute(final String[] argv) throws Exception {
final TextBuiltin cmd = subcommand;
if (cmd.requiresRepository()) {
- if (gitdir == null) {
- String gitDirEnv = SystemReader.getInstance().getenv(Constants.GIT_DIR_KEY);
- if (gitDirEnv != null)
- gitdir = new File(gitDirEnv);
- }
- if (gitdir == null)
- gitdir = findGitDir();
-
- File gitworktree;
- String gitWorkTreeEnv = SystemReader.getInstance().getenv(Constants.GIT_WORK_TREE_KEY);
- if (gitWorkTreeEnv != null)
- gitworktree = new File(gitWorkTreeEnv);
- else
- gitworktree = null;
-
- File indexfile;
- String indexFileEnv = SystemReader.getInstance().getenv(Constants.GIT_INDEX_KEY);
- if (indexFileEnv != null)
- indexfile = new File(indexFileEnv);
- else
- indexfile = null;
-
- File objectdir;
- String objectDirEnv = SystemReader.getInstance().getenv(Constants.GIT_OBJECT_DIRECTORY_KEY);
- if (objectDirEnv != null)
- objectdir = new File(objectDirEnv);
- else
- objectdir = null;
-
- File[] altobjectdirs;
- String altObjectDirEnv = SystemReader.getInstance().getenv(Constants.GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY);
- if (altObjectDirEnv != null) {
- String[] parserdAltObjectDirEnv = altObjectDirEnv.split(File.pathSeparator);
- altobjectdirs = new File[parserdAltObjectDirEnv.length];
- for (int i = 0; i < parserdAltObjectDirEnv.length; i++)
- altobjectdirs[i] = new File(parserdAltObjectDirEnv[i]);
- } else
- altobjectdirs = null;
-
- if (gitdir == null || !gitdir.isDirectory()) {
+ RepositoryBuilder rb = new RepositoryBuilder() //
+ .setGitDir(gitdir) //
+ .readEnvironment() //
+ .findGitDir();
+ if (rb.getGitDir() == null) {
writer.println(CLIText.get().cantFindGitDirectory);
writer.flush();
System.exit(1);
}
- cmd.init(new Repository(gitdir, gitworktree, objectdir, altobjectdirs, indexfile), gitdir);
+
+ cmd.init(rb.build(), null);
} else {
cmd.init(null, gitdir);
}
@@ -224,27 +185,6 @@ private void execute(final String[] argv) throws Exception {
}
}
- private static File findGitDir() {
- Set<String> ceilingDirectories = new HashSet<String>();
- String ceilingDirectoriesVar = SystemReader.getInstance().getenv(
- Constants.GIT_CEILING_DIRECTORIES_KEY);
- if (ceilingDirectoriesVar != null) {
- ceilingDirectories.addAll(Arrays.asList(ceilingDirectoriesVar
- .split(File.pathSeparator)));
- }
- File current = new File("").getAbsoluteFile();
- while (current != null) {
- final File gitDir = new File(current, Constants.DOT_GIT);
- if (gitDir.isDirectory())
- return gitDir;
- current = current.getParentFile();
- if (current != null
- && ceilingDirectories.contains(current.getPath()))
- break;
- }
- return null;
- }
-
private static boolean installConsole() {
try {
install("org.eclipse.jgit.console.ConsoleAuthenticator");
18 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
View
@@ -47,9 +47,10 @@
import java.io.File;
import java.text.MessageFormat;
+import org.eclipse.jgit.errors.RepositoryNotFoundException;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.util.FS;
import org.kohsuke.args4j.Argument;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
@Command(common = false, usage = "usage_ServerSideBackendForJgitPush")
class ReceivePack extends TextBuiltin {
@@ -65,11 +66,14 @@ protected final boolean requiresRepository() {
protected void run() throws Exception {
final org.eclipse.jgit.transport.ReceivePack rp;
- if (new File(dstGitdir, Constants.DOT_GIT).isDirectory())
- dstGitdir = new File(dstGitdir, Constants.DOT_GIT);
- db = new Repository(dstGitdir);
- if (!db.getObjectsDirectory().isDirectory())
- throw die(MessageFormat.format(CLIText.get().notAGitRepository, dstGitdir.getPath()));
+ try {
+ FileKey key = FileKey.lenient(dstGitdir, FS.DETECTED);
+ db = key.open(true /* must exist */);
+ } catch (RepositoryNotFoundException notFound) {
+ throw die(MessageFormat.format(CLIText.get().notAGitRepository,
+ dstGitdir.getPath()));
+ }
+
rp = new org.eclipse.jgit.transport.ReceivePack(db);
rp.receive(System.in, System.out, System.err);
}
4 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
View
@@ -67,9 +67,9 @@
@Override
protected void run() throws Exception {
- root = db.getWorkDir();
+ root = db.getWorkTree();
- final DirCache dirc = DirCache.lock(db);
+ final DirCache dirc = db.lockDirCache();
final DirCacheBuilder edit = dirc.builder();
final TreeWalk walk = new TreeWalk(db);
9 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Tag.java
View
@@ -49,13 +49,12 @@
import java.text.MessageFormat;
-import org.kohsuke.args4j.Argument;
-import org.kohsuke.args4j.Option;
-import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.lib.PersonIdent;
+import org.kohsuke.args4j.Argument;
+import org.kohsuke.args4j.Option;
@Command(common = true, usage = "usage_CreateATag")
class Tag extends TextBuiltin {
@@ -86,9 +85,7 @@ protected void run() throws Exception {
, tagName.substring(Constants.R_TAGS.length())));
}
- final ObjectLoader ldr = db.openObject(object);
- if (ldr == null)
- throw new MissingObjectException(object, "any");
+ final ObjectLoader ldr = db.open(object);
org.eclipse.jgit.lib.Tag tag = new org.eclipse.jgit.lib.Tag(db);
tag.setObjId(object);
26 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
View
@@ -47,10 +47,11 @@
import java.io.File;
import java.text.MessageFormat;
+import org.eclipse.jgit.errors.RepositoryNotFoundException;
+import org.eclipse.jgit.lib.RepositoryCache.FileKey;
+import org.eclipse.jgit.util.FS;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
@Command(common = false, usage = "usage_ServerSideBackendForJgitFetch")
class UploadPack extends TextBuiltin {
@@ -67,16 +68,19 @@ protected final boolean requiresRepository() {
@Override
protected void run() throws Exception {
- final org.eclipse.jgit.transport.UploadPack rp;
+ final org.eclipse.jgit.transport.UploadPack up;
- if (new File(srcGitdir, Constants.DOT_GIT).isDirectory())
- srcGitdir = new File(srcGitdir, Constants.DOT_GIT);
- db = new Repository(srcGitdir);
- if (!db.getObjectsDirectory().isDirectory())
- throw die(MessageFormat.format(CLIText.get().notAGitRepository, srcGitdir.getPath()));
- rp = new org.eclipse.jgit.transport.UploadPack(db);
+ try {
+ FileKey key = FileKey.lenient(srcGitdir, FS.DETECTED);
+ db = key.open(true /* must exist */);
+ } catch (RepositoryNotFoundException notFound) {
+ throw die(MessageFormat.format(CLIText.get().notAGitRepository,
+ srcGitdir.getPath()));
+ }
+
+ up = new org.eclipse.jgit.transport.UploadPack(db);
if (0 <= timeout)
- rp.setTimeout(timeout);
- rp.upload(System.in, System.out, System.err);
+ up.setTimeout(timeout);
+ up.upload(System.in, System.out, System.err);
}
}
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
View
@@ -54,7 +54,7 @@
class MakeCacheTree extends TextBuiltin {
@Override
protected void run() throws Exception {
- final DirCache cache = DirCache.read(db);
+ final DirCache cache = db.readDirCache();
final DirCacheTree tree = cache.getCacheTree(true);
show(tree);
}
3  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
View
@@ -46,7 +46,6 @@
import java.text.MessageFormat;
-import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin;
@@ -56,7 +55,7 @@ protected void run() throws Exception {
final int cnt = 100;
final long start = System.currentTimeMillis();
for (int i = 0; i < cnt; i++)
- DirCache.read(db);
+ db.readDirCache();
final long end = System.currentTimeMillis();
out.print(" ");
out.println(MessageFormat.format(CLIText.get().averageMSPerRead, (end - start) / cnt));
3  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
View
@@ -62,7 +62,6 @@
import org.eclipse.jgit.errors.ObjectWritingException;
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.LockFile;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdRef;
import org.eclipse.jgit.lib.ObjectWriter;
@@ -76,6 +75,7 @@
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.storage.file.LockFile;
/**
* Recreates a repository from another one's commit graph.
@@ -297,6 +297,7 @@ protected void writeFile(final String name, final byte[] content)
name, id));
}
} finally {
+ rw.release();
br.close();
}
return refs;
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
View
@@ -54,7 +54,7 @@
class ShowCacheTree extends TextBuiltin {
@Override
protected void run() throws Exception {
- final DirCache cache = DirCache.read(db);
+ final DirCache cache = db.readDirCache();
final DirCacheTree tree = cache.getCacheTree(false);
if (tree == null)
throw die(CLIText.get().noTREESectionInIndex);
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
View
@@ -59,7 +59,7 @@ protected void run() throws Exception {
final SimpleDateFormat fmt;
fmt = new SimpleDateFormat("yyyyMMdd,HHmmss.SSS");
- final DirCache cache = DirCache.read(db);
+ final DirCache cache = db.readDirCache();
for (int i = 0; i < cache.getEntryCount(); i++) {
final DirCacheEntry ent = cache.getEntry(i);
final FileMode mode = FileMode.fromBits(ent.getRawMode());
127 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java
View
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2010, Google Inc.
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.eclipse.jgit.pgm.debug;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.zip.InflaterInputStream;
+
+import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException;
+import org.eclipse.jgit.lib.NullProgressMonitor;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.ObjectReader;
+import org.eclipse.jgit.pgm.TextBuiltin;
+import org.eclipse.jgit.revwalk.RevObject;
+import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.storage.pack.BinaryDelta;
+import org.eclipse.jgit.storage.pack.ObjectReuseAsIs;
+import org.eclipse.jgit.storage.pack.ObjectToPack;
+import org.eclipse.jgit.storage.pack.PackOutputStream;
+import org.eclipse.jgit.storage.pack.PackWriter;
+import org.eclipse.jgit.storage.pack.StoredObjectRepresentation;
+import org.eclipse.jgit.util.TemporaryBuffer;
+import org.kohsuke.args4j.Argument;
+
+class ShowPackDelta extends TextBuiltin {
+ @Argument(index = 0)
+ private ObjectId objectId;
+
+ @Override
+ protected void run() throws Exception {
+ ObjectReader reader = db.newObjectReader();
+ RevObject obj = new RevWalk(reader).parseAny(objectId);
+ byte[] delta = getDelta(reader, obj);
+
+ // We're crossing our fingers that this will be a delta. Double
+ // check the size field in the header, it should match.
+ //
+ long size = reader.getObjectSize(obj, obj.getType());
+ try {
+ if (BinaryDelta.getResultSize(delta) != size)
+ throw die("Object " + obj.name() + " is not a delta");
+ } catch (ArrayIndexOutOfBoundsException bad) {
+ throw die("Object " + obj.name() + " is not a delta");
+ }
+
+ out.println(BinaryDelta.format(delta));
+ }
+
+ private byte[] getDelta(ObjectReader reader, RevObject obj)
+ throws IOException, MissingObjectException,
+ StoredObjectRepresentationNotAvailableException {
+ ObjectReuseAsIs asis = (ObjectReuseAsIs) reader;
+ ObjectToPack target = asis.newObjectToPack(obj);
+
+ PackWriter pw = new PackWriter(reader) {
+ @Override
+ public void select(ObjectToPack otp, StoredObjectRepresentation next) {
+ otp.select(next);
+ }
+ };
+
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
+ asis.selectObjectRepresentation(pw, target);
+ asis.copyObjectAsIs(new PackOutputStream(NullProgressMonitor.INSTANCE,
+ buf, pw), target);
+
+ // At this point the object header has no delta information,
+ // because it was output as though it were a whole object.
+ // Skip over the header and inflate.
+ //
+ byte[] bufArray = buf.toByteArray();
+ int ptr = 0;
+ while ((bufArray[ptr] & 0x80) != 0)
+ ptr++;
+ ptr++;
+
+ TemporaryBuffer.Heap raw = new TemporaryBuffer.Heap(bufArray.length);
+ InflaterInputStream inf = new InflaterInputStream(
+ new ByteArrayInputStream(bufArray, ptr, bufArray.length));
+ raw.copy(inf);
+ inf.close();
+ return raw.toByteArray();
+ }
+}
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteDirCache.java
View
@@ -51,7 +51,7 @@
class WriteDirCache extends TextBuiltin {
@Override
protected void run() throws Exception {
- final DirCache cache = DirCache.read(db);
+ final DirCache cache = db.readDirCache();
if (!cache.lock())
throw die(CLIText.get().failedToLockIndex);
cache.read();
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Iplog.java
View
@@ -51,7 +51,6 @@
import org.eclipse.jgit.iplog.IpLogGenerator;
import org.eclipse.jgit.iplog.SimpleCookieManager;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.LockFile;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.pgm.Command;
@@ -59,6 +58,7 @@
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.storage.file.LockFile;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
2  org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/eclipse/Ipzilla.java
View
@@ -91,7 +91,7 @@ protected void run() throws Exception {
}
if (output == null)
- output = new File(db.getWorkDir(), IpLogMeta.IPLOG_CONFIG_FILE);
+ output = new File(db.getWorkTree(), IpLogMeta.IPLOG_CONFIG_FILE);
IpLogMeta meta = new IpLogMeta();
meta.syncCQs(output, ipzilla, username, password);
6 org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
View
@@ -59,7 +59,7 @@
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.WindowCursor;
+import org.eclipse.jgit.lib.ObjectReader;
import org.eclipse.jgit.pgm.CLIText;
import org.eclipse.jgit.treewalk.AbstractTreeIterator;
import org.eclipse.jgit.treewalk.CanonicalTreeParser;
@@ -121,9 +121,9 @@ public int parseArguments(final Parameters params) throws CmdLineException {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
final CanonicalTreeParser p = new CanonicalTreeParser();
- final WindowCursor curs = new WindowCursor();
+ final ObjectReader curs = clp.getRepository().newObjectReader();
try {
- p.reset(clp.getRepository(), clp.getRevWalk().parseTree(id), curs);
+ p.reset(curs, clp.getRevWalk().parseTree(id));
} catch (MissingObjectException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) {
2  org.eclipse.jgit.test/META-INF/MANIFEST.MF
View
@@ -29,6 +29,8 @@ Import-Package: junit.framework;version="[3.8.2,4.0.0)",
org.eclipse.jgit.revplot;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.revwalk.filter;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.file;version="[0.9.0,0.10.0)",
+ org.eclipse.jgit.storage.pack;version="[0.9.0,0.10.0)",
org.eclipse.jgit.transport;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk;version="[0.9.0,0.10.0)",
org.eclipse.jgit.treewalk.filter;version="[0.9.0,0.10.0)",
2  org.eclipse.jgit.test/exttst/org/eclipse/jgit/lib/T0007_GitIndexTest.java
View
@@ -116,7 +116,7 @@ public void run() {
protected void setUp() throws Exception {
super.setUp();
db = createWorkRepository();
- trash = db.getWorkDir();
+ trash = db.getWorkTree();
}
public void testCreateEmptyIndex() throws Exception {
44 org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
View
@@ -78,7 +78,7 @@ public void testAddNonExistingSingleFile() throws NoFilepatternException {
}
public void testAddExistingSingleFile() throws IOException, NoFilepatternException {
- File file = new File(db.getWorkDir(), "a.txt");
+ File file = new File(db.getWorkTree(), "a.txt");
file.createNewFile();
PrintWriter writer = new PrintWriter(file);
writer.print("content");
@@ -98,8 +98,8 @@ public void testAddExistingSingleFile() throws IOException, NoFilepatternExcepti
}
public void testAddExistingSingleFileInSubDir() throws IOException, NoFilepatternException {
- new File(db.getWorkDir(), "sub").mkdir();
- File file = new File(db.getWorkDir(), "sub/a.txt");
+ new File(db.getWorkTree(), "sub").mkdir();
+ File file = new File(db.getWorkTree(), "sub/a.txt");
file.createNewFile();
PrintWriter writer = new PrintWriter(file);
writer.print("content");
@@ -119,7 +119,7 @@ public void testAddExistingSingleFileInSubDir() throws IOException, NoFilepatter
}
public void testAddExistingSingleFileTwice() throws IOException, NoFilepatternException {
- File file = new File(db