aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/technical/reftable.md34
-rw-r--r--WORKSPACE37
-rw-r--r--lib/BUILD2
-rw-r--r--org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.jgit.ant.test/pom.xml2
-rw-r--r--org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.ant/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.jgit.ant/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.ant/pom.xml4
-rw-r--r--org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.archive/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.archive/pom.xml2
-rw-r--r--org.eclipse.jgit.benchmarks/pom.xml2
-rw-r--r--org.eclipse.jgit.coverage/pom.xml36
-rw-r--r--org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF12
-rw-r--r--org.eclipse.jgit.http.apache/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.http.apache/pom.xml2
-rw-r--r--org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java3
-rw-r--r--org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.http.server/META-INF/MANIFEST.MF29
-rw-r--r--org.eclipse.jgit.http.server/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.http.server/pom.xml2
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java15
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackErrorHandler.java59
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java71
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java6
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java3
-rw-r--r--org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.http.test/META-INF/MANIFEST.MF40
-rw-r--r--org.eclipse.jgit.http.test/pom.xml2
-rw-r--r--org.eclipse.jgit.http.test/src/org/eclipse/jgit/http/test/RefsUnreadableInMemoryRepository.java41
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java3
-rw-r--r--org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.jgit.junit.http/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.junit.http/pom.xml2
-rw-r--r--org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java8
-rw-r--r--org.eclipse.jgit.junit.ssh/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.jgit.junit.ssh/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.junit.ssh/pom.xml2
-rw-r--r--org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.junit/META-INF/MANIFEST.MF40
-rw-r--r--org.eclipse.jgit.junit/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.junit/pom.xml2
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java3
-rw-r--r--org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF38
-rw-r--r--org.eclipse.jgit.lfs.server.test/pom.xml2
-rw-r--r--org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF32
-rw-r--r--org.eclipse.jgit.lfs.server/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.lfs.server/pom.xml2
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java3
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java3
-rw-r--r--org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF24
-rw-r--r--org.eclipse.jgit.lfs.test/pom.xml2
-rw-r--r--org.eclipse.jgit.lfs/.settings/.api_filters12
-rw-r--r--org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.lfs/META-INF/MANIFEST.MF46
-rw-r--r--org.eclipse.jgit.lfs/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.lfs/pom.xml2
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java6
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java44
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java6
-rw-r--r--org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java6
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties3
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties3
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties3
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties5
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties5
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml8
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties5
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties5
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/license.html23
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.tpd8
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target92
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd8
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target (renamed from org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.target)44
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd8
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target42
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd4
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20191025144108-2019-12.tpd65
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml2
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.20.tpd20
-rw-r--r--org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.22.tpd20
-rw-r--r--org.eclipse.jgit.packaging/pom.xml4
-rw-r--r--org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF36
-rw-r--r--org.eclipse.jgit.pgm.test/pom.xml2
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java44
-rw-r--r--org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.pgm/META-INF/MANIFEST.MF88
-rw-r--r--org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.pgm/pom.xml2
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties3
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java37
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java3
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java3
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java6
-rw-r--r--org.eclipse.jgit.ssh.apache.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.jgit.ssh.apache.test/pom.xml2
-rw-r--r--org.eclipse.jgit.ssh.apache/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF26
-rw-r--r--org.eclipse.jgit.ssh.apache/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.ssh.apache/pom.xml2
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java6
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java3
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java14
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java7
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java3
-rw-r--r--org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.test/BUILD1
-rw-r--r--org.eclipse.jgit.test/META-INF/MANIFEST.MF107
-rw-r--r--org.eclipse.jgit.test/pom.xml2
-rw-r--r--org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java11
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java98
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java55
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java63
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java52
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java38
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchAndPullCommandsRecurseSubmodulesTest.java21
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java24
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java529
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeDirCacheIteratorTest.java109
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeWorkingTreeIteratorTest.java99
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java8
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java24
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java195
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileSnapshotTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java174
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java98
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java52
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java66
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java138
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftree/RefTreeDatabaseTest.java36
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java80
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java14
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSerializerTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java3
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java28
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java167
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java48
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CrissCrossMergeTest.java6
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java48
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java33
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java599
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java66
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java66
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/TreeRevFilterTest.java24
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java89
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java53
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java106
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java62
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java18
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java239
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/AtomicPushTest.java26
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java13
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java22
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitRequestValidatorTest.java92
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitTipRequestValidatorTest.java94
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java319
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TipRequestValidatorTest.java93
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java316
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java118
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java24
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java18
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java89
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java149
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java222
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HookTest.java71
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HttpSupportTest.java69
-rw-r--r--org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit.ui/META-INF/MANIFEST.MF18
-rw-r--r--org.eclipse.jgit.ui/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit.ui/pom.xml2
-rw-r--r--org.eclipse.jgit/.settings/.api_filters164
-rw-r--r--org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--org.eclipse.jgit/META-INF/MANIFEST.MF102
-rw-r--r--org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF4
-rw-r--r--org.eclipse.jgit/pom.xml2
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java29
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java92
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java30
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java37
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java83
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java21
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java17
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java37
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java28
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/LagCheck.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java28
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsCachedPack.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java28
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java22
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java185
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableBatchRefUpdate.java196
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java237
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableStack.java (renamed from org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableStack.java)18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java34
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java102
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/CachedPackUriProvider.java21
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java20
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java65
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java23
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableBatchRefUpdate.java (renamed from org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java)337
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java32
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java294
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java22
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReflogReader.java125
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java40
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileCache.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java68
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java121
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java28
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java137
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java92
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java33
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java38
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java22
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java30
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java40
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java231
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java61
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java23
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java118
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java15
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java17
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java31
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java18
-rw-r--r--pom.xml14
-rw-r--r--tools/bazelisk_version.bzl16
337 files changed, 7005 insertions, 4641 deletions
diff --git a/Documentation/technical/reftable.md b/Documentation/technical/reftable.md
index 47c61a350d..1236a79098 100644
--- a/Documentation/technical/reftable.md
+++ b/Documentation/technical/reftable.md
@@ -89,6 +89,10 @@ Reference names are an uninterpreted sequence of bytes that must pass
[ref-fmt]: https://git-scm.com/docs/git-check-ref-format
+### Key unicity
+
+Each entry must have a unique key; repeated keys are disallowed.
+
### Network byte order
All multi-byte, fixed width fields are in network byte order.
@@ -566,6 +570,10 @@ supplied for the update.
[update-ref]: https://git-scm.com/docs/git-update-ref#_logging_updates
+Contrary to traditional reflog (which is a file), renames are encoded as a
+combination of ref deletion and ref creation.
+
+
#### Reading the log
Readers accessing the log must first read the footer (below) to
@@ -771,12 +779,12 @@ directory. This prevents loose references from being stored.
A collection of reftable files are stored in the `$GIT_DIR/reftable/`
directory:
- 00000001.log
- 00000001.ref
- 00000002.ref
+ 00000001-00000001.log
+ 00000002-00000002.ref
+ 00000003-00000003.ref
where reftable files are named by a unique name such as produced by
-the function `${update_index}.ref`.
+the function `${min_update_index}-${max_update_index}.ref`.
Log-only files use the `.log` extension, while ref-only and mixed ref
and log files use `.ref`. extension.
@@ -786,9 +794,9 @@ files, one per line, in order, from oldest (base) to newest (most
recent):
$ cat .git/refs
- 00000001.log
- 00000001.ref
- 00000002.ref
+ 00000001-00000001.log
+ 00000002-00000002.ref
+ 00000003-00000003.ref
Readers must read `$GIT_DIR/refs` to determine which files are
relevant right now, and search through the stack in reverse order
@@ -815,8 +823,8 @@ new reftable and atomically appending it to the stack:
1. Acquire `refs.lock`.
2. Read `refs` to determine current reftables.
3. Select `update_index` to be most recent file's `max_update_index + 1`.
-4. Prepare temp reftable `${update_index}_XXXXXX`, including log entries.
-5. Rename `${update_index}_XXXXXX` to `${update_index}.ref`.
+4. Prepare temp reftable `tmp_XXXXXX`, including log entries.
+5. Rename `tmp_XXXXXX` to `${update_index}-${update_index}.ref`.
6. Copy `refs` to `refs.lock`, appending file from (5).
7. Rename `refs.lock` to `refs`.
@@ -861,12 +869,13 @@ is going to compact B and C, leaving A and D alone.
Ownership of these locks prevents other processes from trying
to compact these files.
3. Release `refs.lock`.
-4. Compact `B` and `C` into a temp file `${min_update_index}_XXXXXX`.
+4. Compact `B` and `C` into a temp file `${min_update_index}-${max_update_index}_XXXXXX`.
5. Reacquire lock `refs.lock`.
6. Verify that `B` and `C` are still in the stack, in that order. This
should always be the case, assuming that other processes are adhering
to the locking protocol.
-7. Rename `${min_update_index}_XXXXXX` to `${min_update_index}_2.ref`.
+7. Rename `${min_update_index}-${max_update_index}_XXXXXX` to
+ `${min_update_index}-${max_update_index}.ref`.
8. Write the new stack to `refs.lock`, replacing `B` and `C` with the
file from (4).
9. Rename `refs.lock` to `refs`.
@@ -875,6 +884,9 @@ is going to compact B and C, leaving A and D alone.
This strategy permits compactions to proceed independently of updates.
+Each reftable (compacted or not) is uniquely identified by its name, so open
+reftables can be cached by their name.
+
## Alternatives considered
### bzip packed-refs
diff --git a/WORKSPACE b/WORKSPACE
index ca0030240c..eee5565149 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -9,9 +9,14 @@ http_archive(
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/0.8.0.tar.gz"],
)
-load("@bazel_skylib//lib:versions.bzl", "versions")
+# Check Bazel version when invoked by Bazel directly
+load("//tools:bazelisk_version.bzl", "bazelisk_version")
-versions.check(minimum_bazel_version = "0.29.0")
+bazelisk_version(name = "bazelisk_version")
+
+load("@bazelisk_version//:check.bzl", "check_bazel_version")
+
+check_bazel_version()
load("//tools:bazlets.bzl", "load_bazlets")
@@ -125,7 +130,7 @@ maven_jar(
)
maven_jar(
- name = "servlet-api-3_1",
+ name = "servlet-api",
artifact = "javax.servlet:javax.servlet-api:3.1.0",
sha1 = "3cd63d075497751784b2fa84be59432f4905bf7c",
)
@@ -198,48 +203,48 @@ maven_jar(
sha1 = "3edcfe49d2c6053a70a2a47e4e1c2f94998a49cf",
)
-JETTY_VER = "9.4.20.v20190813"
+JETTY_VER = "9.4.22.v20191022"
maven_jar(
name = "jetty-servlet",
artifact = "org.eclipse.jetty:jetty-servlet:" + JETTY_VER,
- sha1 = "d5d6610321bd173aead473e994f170989d633b25",
- src_sha1 = "09aa4fce2579d0905e3bde0b3bc923a032394805",
+ sha1 = "62285df7713347586d55f3f93a96299d1b721714",
+ src_sha1 = "fe2d1f1dc7a82ced141df935a0db5b5cadd76f4a",
)
maven_jar(
name = "jetty-security",
artifact = "org.eclipse.jetty:jetty-security:" + JETTY_VER,
- sha1 = "300c2e6dd62291c512bdaf3ecfefc1e305e26088",
- src_sha1 = "ec03ce3b6a8c0c3dd2bd8b32bc51419caa10ad62",
+ sha1 = "f7b3b61f09b34a69fd6df4f267f3907813c9224c",
+ src_sha1 = "5a1b33c5dde638ce9dbc2e07f0cff862e5029195",
)
maven_jar(
name = "jetty-server",
artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VER,
- sha1 = "d4ee11134bca83db85919a1710fce022c67df3b7",
- src_sha1 = "0db81f86709a8184c793acd309c27dccdb5d439c",
+ sha1 = "f30b9b2cd6f63b073b63c2ac5e7e7f17b63b0908",
+ src_sha1 = "97fbdf8eade55f05d7e99c16fd90d394b248f717",
)
maven_jar(
name = "jetty-http",
artifact = "org.eclipse.jetty:jetty-http:" + JETTY_VER,
- sha1 = "edda2fd904a881114aba79e2f881c6f4004e8148",
- src_sha1 = "3e187c60d578c529f4baa3bbfc727d4b7ca7b93c",
+ sha1 = "f96f87fc73c2b586ff40689cbce6ae62d70f18fa",
+ src_sha1 = "0e51a30d0e3309acfc6ee548b90ff55165fbfa5c",
)
maven_jar(
name = "jetty-io",
artifact = "org.eclipse.jetty:jetty-io:" + JETTY_VER,
- sha1 = "b246c5e350d0aa1b310c07ec362755c34a1cc8cb",
- src_sha1 = "d12619b4df0d202847096a8429b0f96f123c7c77",
+ sha1 = "0f08e62908f94d1238be386302236a42204d566a",
+ src_sha1 = "d31c00383f13c95404ef606f57513569868acd6b",
)
maven_jar(
name = "jetty-util",
artifact = "org.eclipse.jetty:jetty-util:" + JETTY_VER,
- sha1 = "8ee753d673a124ba2880361871ab13f6863b2d40",
- src_sha1 = "2827925d01d95f42d02adf177d2474fbc8a3d5e0",
+ sha1 = "ffe0bf81a2a4a534b79dd981f971c7346a563095",
+ src_sha1 = "42f8abc84a6c4c9d2441d2dfcc60591e3296dc26",
)
BOUNCYCASTLE_VER = "1.61"
diff --git a/lib/BUILD b/lib/BUILD
index 93bb731908..058899fce6 100644
--- a/lib/BUILD
+++ b/lib/BUILD
@@ -224,7 +224,7 @@ java_library(
"//org.eclipse.jgit.lfs.server.test:__pkg__",
"//org.eclipse.jgit.pgm:__pkg__",
],
- exports = ["@servlet-api-3_1//jar"],
+ exports = ["@servlet-api//jar"],
)
java_library(
diff --git a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
index 74ed2712ae..bfa786134c 100644
--- a/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ant.test/META-INF/MANIFEST.MF
@@ -5,13 +5,13 @@ Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.ant.test
Bundle-SymbolicName: org.eclipse.jgit.ant.test
Bundle-Vendor: %Bundle-Vendor
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.tools.ant,
- org.eclipse.jgit.ant.tasks;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.ant.tasks;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)"
diff --git a/org.eclipse.jgit.ant.test/pom.xml b/org.eclipse.jgit.ant.test/pom.xml
index a5d6304288..6935af82a4 100644
--- a/org.eclipse.jgit.ant.test/pom.xml
+++ b/org.eclipse.jgit.ant.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ant.test</artifactId>
diff --git a/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
index 94a1c4f10b..4335e66bf0 100644
--- a/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.ant/META-INF/MANIFEST.MF b/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
index fac3286de1..fbce458a35 100644
--- a/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ant/META-INF/MANIFEST.MF
@@ -3,13 +3,13 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.ant
Bundle-SymbolicName: org.eclipse.jgit.ant
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.tools.ant,
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)"
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)"
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
-Export-Package: org.eclipse.jgit.ant;version="5.5.2",
- org.eclipse.jgit.ant.tasks;version="5.5.2";
+Export-Package: org.eclipse.jgit.ant;version="5.6.0",
+ org.eclipse.jgit.ant.tasks;version="5.6.0";
uses:="org.apache.tools.ant,
org.apache.tools.ant.types"
diff --git a/org.eclipse.jgit.ant/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.ant/META-INF/SOURCE-MANIFEST.MF
index a1ba9cebec..80c658ec48 100644
--- a/org.eclipse.jgit.ant/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.ant/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.ant - Sources
Bundle-SymbolicName: org.eclipse.jgit.ant.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.ant;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.ant;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.ant/pom.xml b/org.eclipse.jgit.ant/pom.xml
index 1c1c494c26..54f8a4b989 100644
--- a/org.eclipse.jgit.ant/pom.xml
+++ b/org.eclipse.jgit.ant/pom.xml
@@ -48,7 +48,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ant</artifactId>
@@ -71,7 +71,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.10.5</version>
+ <version>1.10.7</version>
</dependency>
</dependencies>
diff --git a/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
index ef6f5e732f..bc7ba1e50e 100644
--- a/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.archive/META-INF/MANIFEST.MF b/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
index 14167a64a3..956d243ba7 100644
--- a/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.archive/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.archive
Bundle-SymbolicName: org.eclipse.jgit.archive
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -13,17 +13,17 @@ Import-Package: org.apache.commons.compress.archivers;version="[1.4,2.0)",
org.apache.commons.compress.compressors.bzip2;version="[1.4,2.0)",
org.apache.commons.compress.compressors.gzip;version="[1.4,2.0)",
org.apache.commons.compress.compressors.xz;version="[1.4,2.0)",
- org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.osgi.framework;version="[1.3.0,2.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.jgit.archive.FormatActivator
-Export-Package: org.eclipse.jgit.archive;version="5.5.2";
+Export-Package: org.eclipse.jgit.archive;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.api,
org.apache.commons.compress.archivers,
org.osgi.framework",
- org.eclipse.jgit.archive.internal;version="5.5.2";x-internal:=true
+ org.eclipse.jgit.archive.internal;version="5.6.0";x-internal:=true
diff --git a/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
index 21facee5f0..c0b96705fe 100644
--- a/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.archive/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.archive - Sources
Bundle-SymbolicName: org.eclipse.jgit.archive.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.archive;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.archive;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.archive/pom.xml b/org.eclipse.jgit.archive/pom.xml
index 61d25a605a..65a1f52170 100644
--- a/org.eclipse.jgit.archive/pom.xml
+++ b/org.eclipse.jgit.archive/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.archive</artifactId>
diff --git a/org.eclipse.jgit.benchmarks/pom.xml b/org.eclipse.jgit.benchmarks/pom.xml
index 789ab8208a..c59ff23925 100644
--- a/org.eclipse.jgit.benchmarks/pom.xml
+++ b/org.eclipse.jgit.benchmarks/pom.xml
@@ -45,7 +45,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jgit</groupId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
<artifactId>org.eclipse.jgit.benchmarks</artifactId>
<packaging>jar</packaging>
diff --git a/org.eclipse.jgit.coverage/pom.xml b/org.eclipse.jgit.coverage/pom.xml
index be76c03d8a..9dfb251080 100644
--- a/org.eclipse.jgit.coverage/pom.xml
+++ b/org.eclipse.jgit.coverage/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -18,88 +18,88 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ant</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.archive</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.http.apache</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.http.server</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.lfs</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.lfs.server</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.pgm</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ui</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.apache</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ant.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.http.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.pgm.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.lfs.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.lfs.server.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit.ssh.apache.test</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
</dependencies>
diff --git a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
index 94a1c4f10b..4335e66bf0 100644
--- a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
index 84da9f8cb8..ff97910919 100644
--- a/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.apache/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.http.apache
Bundle-SymbolicName: org.eclipse.jgit.http.apache
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
@@ -23,11 +23,11 @@ Import-Package: org.apache.http;version="[4.3.0,5.0.0)",
org.apache.http.impl.client;version="[4.3.0,5.0.0)",
org.apache.http.impl.conn;version="[4.3.0,5.0.0)",
org.apache.http.params;version="[4.3.0,5.0.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)"
-Export-Package: org.eclipse.jgit.transport.http.apache;version="5.5.2";
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)"
+Export-Package: org.eclipse.jgit.transport.http.apache;version="5.6.0";
uses:="org.apache.http.client,
org.eclipse.jgit.transport.http,
org.apache.http.entity,
diff --git a/org.eclipse.jgit.http.apache/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.http.apache/META-INF/SOURCE-MANIFEST.MF
index 3666a28d00..8950164877 100644
--- a/org.eclipse.jgit.http.apache/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.http.apache/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.http.apache - Sources
Bundle-SymbolicName: org.eclipse.jgit.http.apache.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.http.apache;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.http.apache;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.http.apache/pom.xml b/org.eclipse.jgit.http.apache/pom.xml
index a8f55769d6..4be8a980ff 100644
--- a/org.eclipse.jgit.http.apache/pom.xml
+++ b/org.eclipse.jgit.http.apache/pom.xml
@@ -48,7 +48,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.apache</artifactId>
diff --git a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
index f92c5df792..9d9e2f882d 100644
--- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
+++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
@@ -92,6 +92,7 @@ import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.client.SystemDefaultCredentialsProvider;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.transport.http.HttpConnection;
@@ -165,6 +166,8 @@ public class HttpClientConnection implements HttpConnection {
new BasicHttpClientConnectionManager(registry));
}
clientBuilder.setDefaultRequestConfig(configBuilder.build());
+ clientBuilder.setDefaultCredentialsProvider(
+ new SystemDefaultCredentialsProvider());
client = clientBuilder.build();
}
diff --git a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
index 94a1c4f10b..4335e66bf0 100644
--- a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
index 8d71a4de47..bad1d8a869 100644
--- a/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.server/META-INF/MANIFEST.MF
@@ -3,13 +3,13 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.http.server
Bundle-SymbolicName: org.eclipse.jgit.http.server
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
-Export-Package: org.eclipse.jgit.http.server;version="5.5.2",
- org.eclipse.jgit.http.server.glue;version="5.5.2";
+Export-Package: org.eclipse.jgit.http.server;version="5.6.0",
+ org.eclipse.jgit.http.server.glue;version="5.6.0";
uses:="javax.servlet,javax.servlet.http",
- org.eclipse.jgit.http.server.resolver;version="5.5.2";
+ org.eclipse.jgit.http.server.resolver;version="5.6.0";
uses:="org.eclipse.jgit.transport.resolver,
org.eclipse.jgit.lib,
org.eclipse.jgit.transport,
@@ -18,13 +18,14 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.servlet;version="[2.5.0,3.2.0)",
javax.servlet.http;version="[2.5.0,3.2.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.transport.parser;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.resolver;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)"
+ org.eclipse.jgit.annotations;version="[5.5.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.transport.parser;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)"
diff --git a/org.eclipse.jgit.http.server/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.http.server/META-INF/SOURCE-MANIFEST.MF
index 39c887719d..e051fd8283 100644
--- a/org.eclipse.jgit.http.server/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.http.server/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.http.server - Sources
Bundle-SymbolicName: org.eclipse.jgit.http.server.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.http.server;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.http.server;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.http.server/pom.xml b/org.eclipse.jgit.http.server/pom.xml
index 2d4f758497..97d90d0b54 100644
--- a/org.eclipse.jgit.http.server/pom.xml
+++ b/org.eclipse.jgit.http.server/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.server</artifactId>
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
index 1c5e7ec598..e9462eeb4c 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
@@ -92,6 +92,8 @@ public class GitFilter extends MetaFilter {
private UploadPackFactory<HttpServletRequest> uploadPackFactory = new DefaultUploadPackFactory();
+ private UploadPackErrorHandler uploadPackErrorHandler;
+
private ReceivePackFactory<HttpServletRequest> receivePackFactory = new DefaultReceivePackFactory();
private final List<Filter> uploadPackFilters = new LinkedList<>();
@@ -150,6 +152,17 @@ public class GitFilter extends MetaFilter {
}
/**
+ * Set a custom error handler for git-upload-pack.
+ *
+ * @param h
+ * A custom error handler for git-upload-pack.
+ */
+ public void setUploadPackErrorHandler(UploadPackErrorHandler h) {
+ assertNotInitialized();
+ this.uploadPackErrorHandler = h;
+ }
+
+ /**
* Add upload-pack filter
*
* @param filter
@@ -212,7 +225,7 @@ public class GitFilter extends MetaFilter {
b = b.through(new UploadPackServlet.Factory(uploadPackFactory));
for (Filter f : uploadPackFilters)
b = b.through(f);
- b.with(new UploadPackServlet());
+ b.with(new UploadPackServlet(uploadPackErrorHandler));
}
if (receivePackFactory != ReceivePackFactory.DISABLED) {
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackErrorHandler.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackErrorHandler.java
new file mode 100644
index 0000000000..03be0873b0
--- /dev/null
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackErrorHandler.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2019, Google LLC and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.http.server;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jgit.transport.ServiceMayNotContinueException;
+import org.eclipse.jgit.transport.UploadPack;
+
+/**
+ * Handle git-upload-pack errors.
+ *
+ * <p>
+ * This is an entry point for customizing an error handler for git-upload-pack.
+ * Right before calling {@link UploadPack#uploadWithExceptionPropagation}, JGit
+ * will call this handler if specified through {@link GitFilter}. The
+ * implementation of this handler is responsible for calling
+ * {@link UploadPackRunnable} and handling exceptions for clients.
+ *
+ * <p>
+ * If a custom handler is not specified, JGit will use the default error
+ * handler.
+ *
+ * @since 5.6
+ */
+public interface UploadPackErrorHandler {
+ /**
+ * @param req
+ * The HTTP request
+ * @param rsp
+ * The HTTP response
+ * @param r
+ * A continuation that handles a git-upload-pack request.
+ * @throws IOException
+ */
+ void upload(HttpServletRequest req, HttpServletResponse rsp,
+ UploadPackRunnable r) throws IOException;
+
+ /** Process a git-upload-pack request. */
+ public interface UploadPackRunnable {
+ /**
+ * See {@link UploadPack#uploadWithExceptionPropagation}.
+ *
+ * @throws ServiceMayNotContinueException
+ * @throws IOException
+ */
+ void upload() throws ServiceMayNotContinueException, IOException;
+ }
+}
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
index 0f4037144a..54561e0cfc 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/UploadPackServlet.java
@@ -70,7 +70,8 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
+import org.eclipse.jgit.annotations.Nullable;
+import org.eclipse.jgit.http.server.UploadPackErrorHandler.UploadPackRunnable;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.InternalHttpServerGlue;
import org.eclipse.jgit.transport.PacketLineOut;
@@ -181,53 +182,71 @@ class UploadPackServlet extends HttpServlet {
}
}
+ private final UploadPackErrorHandler handler;
+
+ UploadPackServlet(@Nullable UploadPackErrorHandler handler) {
+ this.handler = handler != null ? handler
+ : this::defaultUploadPackHandler;
+ }
+
/** {@inheritDoc} */
@Override
- public void doPost(final HttpServletRequest req,
- final HttpServletResponse rsp) throws IOException {
+ public void doPost(HttpServletRequest req, HttpServletResponse rsp)
+ throws IOException {
if (!UPLOAD_PACK_REQUEST_TYPE.equals(req.getContentType())) {
rsp.sendError(SC_UNSUPPORTED_MEDIA_TYPE);
return;
}
- SmartOutputStream out = new SmartOutputStream(req, rsp, false) {
- @Override
- public void flush() throws IOException {
- doFlush();
- }
- };
+ UploadPackRunnable r = () -> {
+ UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
+ @SuppressWarnings("resource")
+ SmartOutputStream out = new SmartOutputStream(req, rsp, false) {
+ @Override
+ public void flush() throws IOException {
+ doFlush();
+ }
+ };
- UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
- try {
up.setBiDirectionalPipe(false);
rsp.setContentType(UPLOAD_PACK_RESULT_TYPE);
- up.upload(getInputStream(req), out, null);
- out.close();
-
- } catch (ServiceMayNotContinueException e) {
- if (e.isOutput()) {
+ try {
+ up.upload(getInputStream(req), out, null);
+ out.close();
+ } catch (ServiceMayNotContinueException e) {
+ if (e.isOutput()) {
+ consumeRequestBody(req);
+ out.close();
+ }
+ throw e;
+ } catch (UploadPackInternalServerErrorException e) {
+ // Special case exception, error message was sent to client.
+ log(up.getRepository(), e.getCause());
consumeRequestBody(req);
out.close();
- } else if (!rsp.isCommitted()) {
- rsp.reset();
- sendError(req, rsp, e.getStatusCode(), e.getMessage());
}
- return;
+ };
- } catch (UploadPackInternalServerErrorException e) {
- // Special case exception, error message was sent to client.
- log(up.getRepository(), e.getCause());
- consumeRequestBody(req);
- out.close();
+ handler.upload(req, rsp, r);
+ }
+ private void defaultUploadPackHandler(HttpServletRequest req,
+ HttpServletResponse rsp, UploadPackRunnable r) throws IOException {
+ try {
+ r.upload();
+ } catch (ServiceMayNotContinueException e) {
+ if (!e.isOutput() && !rsp.isCommitted()) {
+ rsp.reset();
+ sendError(req, rsp, e.getStatusCode(), e.getMessage());
+ }
} catch (Throwable e) {
+ UploadPack up = (UploadPack) req.getAttribute(ATTRIBUTE_HANDLER);
log(up.getRepository(), e);
if (!rsp.isCommitted()) {
rsp.reset();
sendError(req, rsp, SC_INTERNAL_SERVER_ERROR);
}
- return;
}
}
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
index f16749775f..574e94a892 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java
@@ -86,10 +86,10 @@ abstract class ServletBinderImpl implements ServletBinder {
* @return the configured servlet, or singleton returning 404 if none.
*/
protected HttpServlet getServlet() {
- if (httpServlet != null)
+ if (httpServlet != null) {
return httpServlet;
- else
- return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND);
+ }
+ return new ErrorServlet(HttpServletResponse.SC_NOT_FOUND);
}
/**
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
index a69fab0afd..b9e6882556 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultUploadPackFactory.java
@@ -83,8 +83,7 @@ public class DefaultUploadPackFactory implements
up.setExtraParameters(Arrays.asList(params));
}
return up;
- } else {
- throw new ServiceNotEnabledException();
}
+ throw new ServiceNotEnabledException();
}
}
diff --git a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
index cec2a09c08..97f1105ad2 100644
--- a/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.http.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.http.test
Bundle-SymbolicName: org.eclipse.jgit.http.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -28,25 +28,25 @@ Import-Package: javax.servlet;version="[2.5.0,3.2.0)",
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.http.server;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.http.server.glue;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.http.server.resolver;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.resolver;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.http.server;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.http.server.glue;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.http.server.resolver;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.hamcrest;version="[1.1.0,2.0.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.http.test/pom.xml b/org.eclipse.jgit.http.test/pom.xml
index 5ab6a7e143..e055c58a15 100644
--- a/org.eclipse.jgit.http.test/pom.xml
+++ b/org.eclipse.jgit.http.test/pom.xml
@@ -51,7 +51,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.http.test</artifactId>
diff --git a/org.eclipse.jgit.http.test/src/org/eclipse/jgit/http/test/RefsUnreadableInMemoryRepository.java b/org.eclipse.jgit.http.test/src/org/eclipse/jgit/http/test/RefsUnreadableInMemoryRepository.java
index 78f909eeac..6f85979785 100644
--- a/org.eclipse.jgit.http.test/src/org/eclipse/jgit/http/test/RefsUnreadableInMemoryRepository.java
+++ b/org.eclipse.jgit.http.test/src/org/eclipse/jgit/http/test/RefsUnreadableInMemoryRepository.java
@@ -43,10 +43,14 @@
package org.eclipse.jgit.http.test;
import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
-import org.eclipse.jgit.internal.storage.reftable.Reftable;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
/**
@@ -82,12 +86,43 @@ class RefsUnreadableInMemoryRepository extends InMemoryRepository {
}
private class RefsUnreadableRefDatabase extends MemRefDatabase {
+
+ /** {@inheritDoc} */
+ @Override
+ public Ref exactRef(String name) throws IOException {
+ if (failing) {
+ throw new IOException("disk failed, no refs found");
+ }
+ return super.exactRef(name);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Map<String, Ref> getRefs(String prefix) throws IOException {
+ if (failing) {
+ throw new IOException("disk failed, no refs found");
+ }
+
+ return super.getRefs(prefix);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public List<Ref> getRefsByPrefix(String prefix) throws IOException {
+ if (failing) {
+ throw new IOException("disk failed, no refs found");
+ }
+
+ return super.getRefsByPrefix(prefix);
+ }
+
+ /** {@inheritDoc} */
@Override
- protected Reftable reader() throws IOException {
+ public Set<Ref> getTipsWithSha1(ObjectId id) throws IOException {
if (failing) {
throw new IOException("disk failed, no refs found");
}
- return super.reader();
+ return super.getTipsWithSha1(id);
}
}
}
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
index 3401e264c0..99aa06b17c 100644
--- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
+++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java
@@ -331,9 +331,8 @@ public class SmartClientSmartServerTest extends AllFactoriesHttpTestCase {
String fragment = u.getRawFragment();
if (fragment != null) {
return u.getRawPath() + '#' + fragment;
- } else {
- return u.getRawPath();
}
+ return u.getRawPath();
} catch (URISyntaxException e) {
return url;
}
diff --git a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
index a7254a3b62..5806277710 100644
--- a/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit.http/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.junit.http
Bundle-SymbolicName: org.eclipse.jgit.junit.http
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
@@ -22,16 +22,16 @@ Import-Package: javax.servlet;version="[2.5.0,3.2.0)",
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.ssl;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.http.server;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.resolver;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.http.server;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.6.0,5.7.0)",
org.junit;version="[4.12,5.0.0)"
-Export-Package: org.eclipse.jgit.junit.http;version="5.5.2";
+Export-Package: org.eclipse.jgit.junit.http;version="5.6.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.jgit.junit,
javax.servlet.http,
diff --git a/org.eclipse.jgit.junit.http/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.junit.http/META-INF/SOURCE-MANIFEST.MF
index 6f5590bcac..b454cd0fec 100644
--- a/org.eclipse.jgit.junit.http/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.junit.http/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.junit.http - Sources
Bundle-SymbolicName: org.eclipse.jgit.junit.http.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.junit.http;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.junit.http;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.junit.http/pom.xml b/org.eclipse.jgit.junit.http/pom.xml
index e4b2c6be37..c69f194b8a 100644
--- a/org.eclipse.jgit.junit.http/pom.xml
+++ b/org.eclipse.jgit.junit.http/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.junit.http</artifactId>
diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
index 9aef086b78..33cbd2b595 100644
--- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
+++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java
@@ -205,7 +205,7 @@ public class AppServer {
}
private SslContextFactory createTestSslContextFactory(String hostName) {
- SslContextFactory factory = new SslContextFactory(true);
+ SslContextFactory.Client factory = new SslContextFactory.Client(true);
String dName = "CN=,OU=,O=,ST=,L=,C=";
@@ -308,10 +308,10 @@ public class AppServer {
@Override
protected String[] loadRoleInfo(UserPrincipal user) {
- if (users.get(user.getName()) == null)
+ if (users.get(user.getName()) == null) {
return null;
- else
- return new String[] { role };
+ }
+ return new String[] { role };
}
@Override
diff --git a/org.eclipse.jgit.junit.ssh/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit.ssh/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.junit.ssh/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.junit.ssh/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF
index ff2edd3730..7ece7603f9 100644
--- a/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit.ssh/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.junit.ssh
Bundle-SymbolicName: org.eclipse.jgit.junit.ssh
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
@@ -30,8 +30,8 @@ Import-Package: org.apache.sshd.common;version="[2.2.0,2.3.0)",
org.apache.sshd.server.shell;version="[2.2.0,2.3.0)",
org.apache.sshd.server.subsystem;version="[2.2.0,2.3.0)",
org.apache.sshd.server.subsystem.sftp;version="[2.2.0,2.3.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
org.slf4j;version="[1.7.0,2.0.0)"
-Export-Package: org.eclipse.jgit.junit.ssh;version="5.5.2"
+Export-Package: org.eclipse.jgit.junit.ssh;version="5.6.0"
diff --git a/org.eclipse.jgit.junit.ssh/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.junit.ssh/META-INF/SOURCE-MANIFEST.MF
index c828888b57..2438c0085e 100644
--- a/org.eclipse.jgit.junit.ssh/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.junit.ssh/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.junit.ssh - Sources
Bundle-SymbolicName: org.eclipse.jgit.junit.ssh.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.junit.ssh;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.junit.ssh;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.junit.ssh/pom.xml b/org.eclipse.jgit.junit.ssh/pom.xml
index 3b28c00bae..d4591d7338 100644
--- a/org.eclipse.jgit.junit.ssh/pom.xml
+++ b/org.eclipse.jgit.junit.ssh/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.junit.ssh</artifactId>
diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
index b6750293dc..530f8f6070 100644
--- a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs
@@ -103,7 +103,7 @@ org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
diff --git a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
index 4de3e46fdb..aedfaa99f2 100644
--- a/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.junit/META-INF/MANIFEST.MF
@@ -3,35 +3,35 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.junit
Bundle-SymbolicName: org.eclipse.jgit.junit
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.dircache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.merge;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="5.5.2",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.io;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.time;version="[5.5.2,5.6.0)",
+Import-Package: org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.dircache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.merge;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="5.6.0",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.io;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.time;version="[5.6.0,5.7.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
org.junit.runner;version="[4.12,5.0.0)",
org.junit.runners;version="[4.12,5.0.0)",
org.junit.runners.model;version="[4.12,5.0.0)",
org.slf4j;version="[1.7.0,2.0.0)"
-Export-Package: org.eclipse.jgit.junit;version="5.5.2";
+Export-Package: org.eclipse.jgit.junit;version="5.6.0";
uses:="org.eclipse.jgit.dircache,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
@@ -44,4 +44,4 @@ Export-Package: org.eclipse.jgit.junit;version="5.5.2";
org.junit.runners.model,
org.junit.runner,
org.eclipse.jgit.util.time",
- org.eclipse.jgit.junit.time;version="5.5.2";uses:="org.eclipse.jgit.util.time"
+ org.eclipse.jgit.junit.time;version="5.6.0";uses:="org.eclipse.jgit.util.time"
diff --git a/org.eclipse.jgit.junit/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.junit/META-INF/SOURCE-MANIFEST.MF
index 9568f93759..d9a24d8dea 100644
--- a/org.eclipse.jgit.junit/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.junit/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.junit - Sources
Bundle-SymbolicName: org.eclipse.jgit.junit.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.junit;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.junit;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.junit/pom.xml b/org.eclipse.jgit.junit/pom.xml
index 1ccc2202d2..af0a7f1c7a 100644
--- a/org.eclipse.jgit.junit/pom.xml
+++ b/org.eclipse.jgit.junit/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.junit</artifactId>
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
index 362007a982..240c4429eb 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java
@@ -782,9 +782,8 @@ public class TestRepository<R extends Repository> implements AutoCloseable {
}
update(Constants.HEAD, result);
return pool.parseCommit(result);
- } else {
- throw new IOException("Merge conflict");
}
+ throw new IOException("Merge conflict");
}
/**
diff --git a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
index bcd5cf02f5..4279a4aeb9 100644
--- a/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.lfs.server.test
Bundle-SymbolicName: org.eclipse.jgit.lfs.server.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -28,24 +28,24 @@ Import-Package: javax.servlet;version="[3.1.0,4.0.0)",
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.server;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.server.fs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.test;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.server;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.server.fs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.test;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.lfs.server.test/pom.xml b/org.eclipse.jgit.lfs.server.test/pom.xml
index a116a6db48..6fb9b78c93 100644
--- a/org.eclipse.jgit.lfs.server.test/pom.xml
+++ b/org.eclipse.jgit.lfs.server.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.server.test</artifactId>
diff --git a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
index 525ac67142..9fd92b1098 100644
--- a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
index f519f26f7a..fb0ee06d6e 100644
--- a/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server/META-INF/MANIFEST.MF
@@ -3,19 +3,19 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.lfs.server
Bundle-SymbolicName: org.eclipse.jgit.lfs.server
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
-Export-Package: org.eclipse.jgit.lfs.server;version="5.5.2";
+Export-Package: org.eclipse.jgit.lfs.server;version="5.6.0";
uses:="javax.servlet.http,
org.eclipse.jgit.lfs.lib",
- org.eclipse.jgit.lfs.server.fs;version="5.5.2";
+ org.eclipse.jgit.lfs.server.fs;version="5.6.0";
uses:="javax.servlet,
javax.servlet.http,
org.eclipse.jgit.lfs.server,
org.eclipse.jgit.lfs.lib",
- org.eclipse.jgit.lfs.server.internal;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.lfs.server.s3;version="5.5.2";
+ org.eclipse.jgit.lfs.server.internal;version="5.6.0";x-internal:=true,
+ org.eclipse.jgit.lfs.server.s3;version="5.6.0";
uses:="org.eclipse.jgit.lfs.server,
org.eclipse.jgit.lfs.lib"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -25,15 +25,15 @@ Import-Package: com.google.gson;version="[2.8.0,3.0.0)",
javax.servlet.http;version="[3.1.0,4.0.0)",
org.apache.http;version="[4.3.0,5.0.0)",
org.apache.http.client;version="[4.3.0,5.0.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.slf4j;version="[1.7.0,2.0.0)"
diff --git a/org.eclipse.jgit.lfs.server/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.lfs.server/META-INF/SOURCE-MANIFEST.MF
index 55cdc0bff6..6f1c3a4731 100644
--- a/org.eclipse.jgit.lfs.server/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.server/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.lfs.server - Sources
Bundle-SymbolicName: org.eclipse.jgit.lfs.server.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.lfs.server;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.lfs.server;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.lfs.server/pom.xml b/org.eclipse.jgit.lfs.server/pom.xml
index 01a0b8d5c0..b95806b17d 100644
--- a/org.eclipse.jgit.lfs.server/pom.xml
+++ b/org.eclipse.jgit.lfs.server/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.server</artifactId>
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
index 0a7c37ca55..ad9ef78036 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
@@ -110,9 +110,8 @@ public class FileLfsRepository implements LargeFileRepository {
Path p = getPath(id);
if (Files.exists(p)) {
return Files.size(p);
- } else {
- return -1;
}
+ return -1;
}
/**
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
index 7b76cecf0c..4bcca4a9a1 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java
@@ -352,9 +352,8 @@ class SignerV4 {
String encodedPath = urlEncode(path, true);
if (encodedPath.startsWith("/")) { //$NON-NLS-1$
return encodedPath;
- } else {
- return "/" + encodedPath; //$NON-NLS-1$
}
+ return "/" + encodedPath; //$NON-NLS-1$
}
private static byte[] hash(String s) {
diff --git a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
index cf10aa641f..549a0ff8f7 100644
--- a/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs.test/META-INF/MANIFEST.MF
@@ -3,22 +3,22 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.lfs.test
Bundle-SymbolicName: org.eclipse.jgit.lfs.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.internal.storage.dfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+Import-Package: org.eclipse.jgit.internal.storage.dfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.hamcrest.core;version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.runner;version="[4.12,5.0.0)",
org.junit.runners;version="[4.12,5.0.0)"
-Export-Package: org.eclipse.jgit.lfs.test;version="5.5.2";x-friends:="org.eclipse.jgit.lfs.server.test"
+Export-Package: org.eclipse.jgit.lfs.test;version="5.6.0";x-friends:="org.eclipse.jgit.lfs.server.test"
diff --git a/org.eclipse.jgit.lfs.test/pom.xml b/org.eclipse.jgit.lfs.test/pom.xml
index 8166a07081..d1691c3183 100644
--- a/org.eclipse.jgit.lfs.test/pom.xml
+++ b/org.eclipse.jgit.lfs.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs.test</artifactId>
diff --git a/org.eclipse.jgit.lfs/.settings/.api_filters b/org.eclipse.jgit.lfs/.settings/.api_filters
deleted file mode 100644
index 9747df8aa2..0000000000
--- a/org.eclipse.jgit.lfs/.settings/.api_filters
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.jgit.lfs" version="2">
- <resource path="src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java" type="org.eclipse.jgit.lfs.lib.AnyLongObjectId">
- <filter id="1141899266">
- <message_arguments>
- <message_argument value="5.4"/>
- <message_argument value="5.5"/>
- <message_argument value="isEqual(AnyLongObjectId, AnyLongObjectId)"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
index 525ac67142..9fd92b1098 100644
--- a/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF b/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
index da1fbd7741..1fd1957afe 100644
--- a/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.lfs/META-INF/MANIFEST.MF
@@ -3,33 +3,33 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.lfs
Bundle-SymbolicName: org.eclipse.jgit.lfs
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
-Export-Package: org.eclipse.jgit.lfs;version="5.5.2",
- org.eclipse.jgit.lfs.errors;version="5.5.2",
- org.eclipse.jgit.lfs.internal;version="5.5.2";x-friends:="org.eclipse.jgit.lfs.test,org.eclipse.jgit.lfs.server.fs,org.eclipse.jgit.lfs.server",
- org.eclipse.jgit.lfs.lib;version="5.5.2"
+Export-Package: org.eclipse.jgit.lfs;version="5.6.0",
+ org.eclipse.jgit.lfs.errors;version="5.6.0",
+ org.eclipse.jgit.lfs.internal;version="5.6.0";x-friends:="org.eclipse.jgit.lfs.test,org.eclipse.jgit.lfs.server.fs,org.eclipse.jgit.lfs.server",
+ org.eclipse.jgit.lfs.lib;version="5.6.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.google.gson;version="[2.8.2,3.0.0)",
com.google.gson.stream;version="[2.8.2,3.0.0)",
org.apache.http.impl.client;version="[4.2.6,5.0.0)",
org.apache.http.impl.conn;version="[4.2.6,5.0.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)";resolution:=optional,
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.attributes;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.diff;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.hooks;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.io;version="[5.5.2,5.6.0)"
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)";resolution:=optional,
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.attributes;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.diff;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.hooks;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.io;version="[5.6.0,5.7.0)"
diff --git a/org.eclipse.jgit.lfs/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.lfs/META-INF/SOURCE-MANIFEST.MF
index 562747d66e..382d1561e1 100644
--- a/org.eclipse.jgit.lfs/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.lfs/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.lfs - Sources
Bundle-SymbolicName: org.eclipse.jgit.lfs.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.lfs;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.lfs;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.lfs/pom.xml b/org.eclipse.jgit.lfs/pom.xml
index 1f2afd958c..f1df7a0833 100644
--- a/org.eclipse.jgit.lfs/pom.xml
+++ b/org.eclipse.jgit.lfs/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.lfs</artifactId>
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
index 56e3a12ddc..3c5826362c 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/BuiltinLFS.java
@@ -83,9 +83,8 @@ public class BuiltinLFS extends LfsFactory {
Attribute attribute) throws IOException {
if (isEnabled(db) && (attribute == null || isEnabled(db, attribute))) {
return LfsBlobFilter.smudgeLfsBlob(db, loader);
- } else {
- return loader;
}
+ return loader;
}
@Override
@@ -93,9 +92,8 @@ public class BuiltinLFS extends LfsFactory {
long length, Attribute attribute) throws IOException {
if (isEnabled(db, attribute)) {
return new LfsInputStream(LfsBlobFilter.cleanLfsBlob(db, input));
- } else {
- return new LfsInputStream(input, length);
}
+ return new LfsInputStream(input, length);
}
@Override
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
index 80da802db4..2329ade290 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/CleanFilter.java
@@ -138,32 +138,30 @@ public class CleanFilter extends FilterCommand {
aOut.write(buf, 0, length);
size += length;
return length;
+ }
+ aOut.close();
+ AnyLongObjectId loid = aOut.getId();
+ aOut = null;
+ Path mediaFile = lfsUtil.getMediaFile(loid);
+ if (Files.isRegularFile(mediaFile)) {
+ long fsSize = Files.size(mediaFile);
+ if (fsSize != size) {
+ throw new CorruptMediaFile(mediaFile, size, fsSize);
+ }
+ FileUtils.delete(tmpFile.toFile());
} else {
- aOut.close();
- AnyLongObjectId loid = aOut.getId();
- aOut = null;
- Path mediaFile = lfsUtil.getMediaFile(loid);
- if (Files.isRegularFile(mediaFile)) {
- long fsSize = Files.size(mediaFile);
- if (fsSize != size) {
- throw new CorruptMediaFile(mediaFile, size, fsSize);
- } else {
- FileUtils.delete(tmpFile.toFile());
- }
- } else {
- Path parent = mediaFile.getParent();
- if (parent != null) {
- FileUtils.mkdirs(parent.toFile(), true);
- }
- FileUtils.rename(tmpFile.toFile(), mediaFile.toFile(),
- StandardCopyOption.ATOMIC_MOVE);
+ Path parent = mediaFile.getParent();
+ if (parent != null) {
+ FileUtils.mkdirs(parent.toFile(), true);
}
- LfsPointer lfsPointer = new LfsPointer(loid, size);
- lfsPointer.encode(out);
- in.close();
- out.close();
- return -1;
+ FileUtils.rename(tmpFile.toFile(), mediaFile.toFile(),
+ StandardCopyOption.ATOMIC_MOVE);
}
+ LfsPointer lfsPointer = new LfsPointer(loid, size);
+ lfsPointer.encode(out);
+ in.close();
+ out.close();
+ return -1;
} catch (IOException e) {
if (aOut != null) {
aOut.abort();
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
index feb8b4ae5a..184658d4d2 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
@@ -179,9 +179,8 @@ public class LfsConnectionFactory {
remoteUrl, u);
additionalHeaders.putAll(action.header);
return action.href;
- } else {
- return remoteUrl + Protocol.INFO_LFS_ENDPOINT;
}
+ return remoteUrl + Protocol.INFO_LFS_ENDPOINT;
}
private static Protocol.ExpiringAction getSshAuthentication(
@@ -262,9 +261,8 @@ public class LfsConnectionFactory {
if (path.endsWith(org.eclipse.jgit.lib.Constants.DOT_GIT)) {
return path.substring(0, path.length() - 4);
- } else {
- return path;
}
+ return path;
}
/**
diff --git a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
index b095d20e63..a9bd27f5c5 100644
--- a/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
+++ b/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/lib/AnyLongObjectId.java
@@ -303,10 +303,10 @@ public abstract class AnyLongObjectId implements Comparable<AnyLongObjectId> {
/** {@inheritDoc} */
@Override
public final boolean equals(Object o) {
- if (o instanceof AnyLongObjectId)
+ if (o instanceof AnyLongObjectId) {
return equals((AnyLongObjectId) o);
- else
- return false;
+ }
+ return false;
}
/**
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties
index 169ef7ef6a..d47cc013dc 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.properties
@@ -30,7 +30,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -69,7 +68,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
index 2a1a0b64ab..fb36ac0abc 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
index 9f2a30dde7..0cbe270867 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties
index 480e9c3888..b2fd6ed5cf 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.properties
@@ -30,7 +30,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -69,7 +68,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
index 4096f8d9a7..de604cd6e0 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.http.apache"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -23,7 +23,7 @@
</url>
<requires>
- <import plugin="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
+ <import plugin="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
index 200a1e5111..81e69d24f0 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.http.apache.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties
index 291b29e3b7..acf33a9cef 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.properties
@@ -31,7 +31,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -70,7 +69,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
index aa43cefd29..4604b4f8a0 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.junit"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -24,7 +24,7 @@
<requires>
<import plugin="com.jcraft.jsch"/>
- <import plugin="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
+ <import plugin="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
index 23d3450a1a..5d07fa479b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.junit.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties
index 8387585cda..5d953fa4c1 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.properties
@@ -30,7 +30,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -69,7 +68,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
@@ -174,4 +173,4 @@ permitted.\n\
\n\
Java and all Java-based trademarks are trademarks of Oracle Corporation in the\n\
United States, other countries, or both.\n
-########### end of license property ##########################################
+########### end of license property ########################################## \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
index 781e94af2b..1b2897d04c 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.lfs"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -23,7 +23,7 @@
</url>
<requires>
- <import feature="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
index b5fb886ede..0a828971bd 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.lfs.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties
index ef9031ebce..450cff4a05 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.properties
@@ -30,7 +30,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -69,7 +68,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
@@ -174,4 +173,4 @@ permitted.\n\
\n\
Java and all Java-based trademarks are trademarks of Oracle Corporation in the\n\
United States, other countries, or both.\n
-########### end of license property ##########################################
+########### end of license property ########################################## \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
index 8656890e8a..dd662c9f28 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.pgm"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -35,9 +35,9 @@
version="0.0.0"/>
<requires>
- <import feature="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
- <import feature="org.eclipse.jgit.lfs" version="5.5.2" match="equivalent"/>
- <import feature="org.eclipse.jgit.ssh.apache" version="5.5.2" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
+ <import feature="org.eclipse.jgit.lfs" version="5.6.0" match="equivalent"/>
+ <import feature="org.eclipse.jgit.ssh.apache" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
index b4fe972526..504c1a8c90 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.pgm.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
index 63c76bf7a3..8f21d1d92f 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.repository/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.repository</artifactId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties
index c04dc630de..5043c3234e 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.properties
@@ -31,7 +31,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -70,7 +69,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
@@ -175,4 +174,4 @@ permitted.\n\
\n\
Java and all Java-based trademarks are trademarks of Oracle Corporation in the\n\
United States, other countries, or both.\n
-########### end of license property ##########################################
+########### end of license property ########################################## \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
index 8781c66ab3..d4828e47c3 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.source"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -23,7 +23,7 @@
</url>
<requires>
- <import feature="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
index 9ce5ec4400..933cc8f495 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.source.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
@@ -63,7 +63,7 @@
<dependency>
<groupId>org.eclipse.jgit.feature</groupId>
<artifactId>org.eclipse.jgit</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</dependency>
</dependencies>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties
index 2b086129ff..e412fc2179 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.properties
@@ -30,7 +30,6 @@ http://www.eclipse.org/org/documents/edl-v10.html\n
# "licenseURL" property - URL of the "Feature License"
# do not translate value - just change to point to a locale-specific HTML page
licenseURL=license.html
-
# "license" property - text of the "Feature Update License"
# should be plain text version of license agreement pointed to be "licenseURL"
license=\
@@ -69,7 +68,7 @@ downloadable archives ("Downloads").\n\
include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and\n\
features ("Features").\n\
- Each Plug-in or Fragment may be packaged as a sub-directory or JAR\n\
- (Javaâ„¢ ARchive) in a directory named "plugins".\n\
+ (Java\u2122 ARchive) in a directory named "plugins".\n\
- A Feature is a bundle of one or more Plug-ins and/or Fragments and\n\
associated material. Each Feature may be packaged as a sub-directory in a\n\
directory named "features". Within a Feature, files named "feature.xml" may\n\
@@ -174,4 +173,4 @@ permitted.\n\
\n\
Java and all Java-based trademarks are trademarks of Oracle Corporation in the\n\
United States, other countries, or both.\n
-########### end of license property ##########################################
+########### end of license property ########################################## \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml
index a55f941399..2582a77e77 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.jgit.ssh.apache"
label="%featureName"
- version="5.5.2.qualifier"
+ version="5.6.0.qualifier"
provider-name="%providerName">
<description url="http://www.eclipse.org/jgit/">
@@ -23,7 +23,7 @@
</url>
<requires>
- <import feature="org.eclipse.jgit" version="5.5.2" match="equivalent"/>
+ <import feature="org.eclipse.jgit" version="5.6.0" match="equivalent"/>
</requires>
<plugin
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/license.html b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/license.html
index 008b8018db..004b6dec6b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/license.html
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/license.html
@@ -5,13 +5,10 @@
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Eclipse Foundation Software User Agreement</title>
</head>
-
<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
<p>November 22, 2017</p>
-
<h3>Usage Of Content</h3>
-
<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
@@ -24,9 +21,7 @@
AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
USE THE CONTENT.</p>
-
<h3>Applicable Licenses</h3>
-
<p>
Unless otherwise indicated, all Content made available by the Eclipse
Foundation is provided to you under the terms and conditions of the
@@ -35,13 +30,11 @@
href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.
</p>
-
<p>Content includes, but is not limited to, source code, object
code, documentation and other files maintained in the Eclipse
Foundation source code repository (&quot;Repository&quot;) in software
modules (&quot;Modules&quot;) and made available as downloadable
archives (&quot;Downloads&quot;).</p>
-
<ul>
<li>Content may be structured and packaged into modules to
facilitate delivering, extending, and upgrading the Content. Typical
@@ -62,7 +55,6 @@
&quot;feature.xml&quot; may contain a list of the names and version
numbers of Included Features.</li>
</ul>
-
<p>The terms and conditions governing Plug-ins and Fragments should
be contained in files named &quot;about.html&quot;
(&quot;Abouts&quot;). The terms and conditions governing Features and
@@ -70,7 +62,6 @@
&quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and
Feature Licenses may be located in any directory of a Download or
Module including, but not limited to the following locations:</p>
-
<ul>
<li>The top-level (root) directory</li>
<li>Plug-in and Fragment directories</li>
@@ -79,7 +70,6 @@
certain Plug-ins</li>
<li>Feature directories</li>
</ul>
-
<p>Note: if a Feature made available by the Eclipse Foundation is
installed using the Provisioning Technology (as defined below), you
must agree to a license (&quot;Feature Update License&quot;) during
@@ -92,12 +82,10 @@
Feature Licenses, and Feature Update Licenses contain the terms and
conditions (or references to such terms and conditions) that govern
your use of the associated Content in that directory.</p>
-
<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND
CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT
ARE NOT LIMITED TO):</p>
-
<ul>
<li>Eclipse Public License Version 1.0 (available at <a
href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>)
@@ -118,16 +106,12 @@
href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)
</li>
</ul>
-
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND
CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License,
or Feature Update License is provided, please contact the Eclipse
Foundation to determine what terms and conditions govern that
particular Content.</p>
-
-
<h3>Use of Provisioning Technology</h3>
-
<p>
The Eclipse Foundation makes available provisioning software, examples
of which include, but are not limited to, p2 and the Eclipse Update
@@ -140,7 +124,6 @@
href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
(&quot;Specification&quot;).
</p>
-
<p>You may use Provisioning Technology to allow other parties to
install Installable Software. You shall be responsible for enabling
the applicable license agreements relating to the Installable Software
@@ -149,7 +132,6 @@
Technology in such a manner and making it available in accordance with
the Specification, you further acknowledge your agreement to, and the
acquisition of all necessary rights to permit the following:</p>
-
<ol>
<li>A series of actions may occur (&quot;Provisioning
Process&quot;) in which a user may execute the Provisioning
@@ -171,19 +153,16 @@
provisioning Technology will complete installation of the Installable
Software.</li>
</ol>
-
<h3>Cryptography</h3>
-
<p>Content may contain encryption software. The country in which
you are currently may have restrictions on the import, possession, and
use, and/or re-export to another country, of encryption software.
BEFORE using any encryption software, please check the country's laws,
regulations and policies concerning the import, possession, or use,
and re-export of encryption software, to see if this is permitted.</p>
-
<p>
<small>Java and all Java-based trademarks are trademarks of
Oracle Corporation in the United States, other countries, or both.</small>
</p>
</body>
-</html>
+</html> \ No newline at end of file
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/pom.xml
index 9ebafcae5c..6fa69eae07 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.ssh.apache.feature/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jgit.feature</groupId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
index 5954a34338..068c15dd98 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/META-INF/MANIFEST.MF
@@ -2,4 +2,4 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JGit Target Platform Bundle
Bundle-SymbolicName: org.eclipse.jgit.target
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
index 771682c415..521429a1a8 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.10" sequenceNumber="1567671414">
+<target name="jgit-4.10" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd
index e5fce09c0e..83ef4a93d2 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.10.tpd
@@ -1,7 +1,7 @@
target "jgit-4.10" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/2018-12/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
index 2466f8995e..32f6e25350 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.11" sequenceNumber="1567671414">
+<target name="jgit-4.11" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd
index 09d29c0d43..10813f689a 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.11.tpd
@@ -1,7 +1,7 @@
target "jgit-4.11" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/2019-03/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
index 4f06536f12..d4b5a5b020 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.12" sequenceNumber="1567671414">
+<target name="jgit-4.12" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd
index 3286f77aab..10f3bc0850 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.12.tpd
@@ -1,7 +1,7 @@
target "jgit-4.12" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/2019-06/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.tpd
deleted file mode 100644
index e82ed5f95e..0000000000
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.tpd
+++ /dev/null
@@ -1,8 +0,0 @@
-target "jgit-4.13-staging" with source configurePhase
-
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
-
-location "http://download.eclipse.org/staging/2019-09/" {
- org.eclipse.osgi lazy
-}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target
new file mode 100644
index 0000000000..4e60fce65d
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.target
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?pde?>
+<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
+<target name="jgit-4.13" sequenceNumber="1572347462">
+ <locations>
+ <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
+ </location>
+ <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
+ <unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
+ <unit id="com.google.gson.source" version="2.8.2.v20180104-1110"/>
+ <unit id="com.jcraft.jsch" version="0.1.55.v20190404-1902"/>
+ <unit id="com.jcraft.jsch.source" version="0.1.55.v20190404-1902"/>
+ <unit id="com.jcraft.jzlib" version="1.1.1.v201205102305"/>
+ <unit id="com.jcraft.jzlib.source" version="1.1.1.v201205102305"/>
+ <unit id="javaewah" version="1.1.6.v20160919-1400"/>
+ <unit id="javaewah.source" version="1.1.6.v20160919-1400"/>
+ <unit id="javax.servlet" version="3.1.0.v201410161800"/>
+ <unit id="javax.servlet.source" version="3.1.0.v201410161800"/>
+ <unit id="net.bytebuddy.byte-buddy" version="1.9.0.v20181107-1410"/>
+ <unit id="net.bytebuddy.byte-buddy-agent" version="1.9.0.v20181106-1534"/>
+ <unit id="net.bytebuddy.byte-buddy-agent.source" version="1.9.0.v20181106-1534"/>
+ <unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
+ <unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
+ <unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
+ <unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
+ <unit id="org.apache.commons.compress.source" version="1.18.0.v20181121-2221"/>
+ <unit id="org.apache.commons.logging" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.commons.logging.source" version="1.2.0.v20180409-1502"/>
+ <unit id="org.apache.httpcomponents.httpclient" version="4.5.6.v20190503-0009"/>
+ <unit id="org.apache.httpcomponents.httpclient.source" version="4.5.6.v20190503-0009"/>
+ <unit id="org.apache.httpcomponents.httpcore" version="4.4.10.v20190123-2214"/>
+ <unit id="org.apache.httpcomponents.httpcore.source" version="4.4.10.v20190123-2214"/>
+ <unit id="org.apache.log4j" version="1.2.15.v201012070815"/>
+ <unit id="org.apache.log4j.source" version="1.2.15.v201012070815"/>
+ <unit id="org.apache.sshd.osgi" version="2.2.0.v20190425-2127"/>
+ <unit id="org.apache.sshd.osgi.source" version="2.2.0.v20190425-2127"/>
+ <unit id="org.apache.sshd.sftp" version="2.2.0.v20190425-2127"/>
+ <unit id="org.apache.sshd.sftp.source" version="2.2.0.v20190425-2127"/>
+ <unit id="org.bouncycastle.bcpg" version="1.61.0.v20190602-1335"/>
+ <unit id="org.bouncycastle.bcpg.source" version="1.61.0.v20190602-1335"/>
+ <unit id="org.bouncycastle.bcpkix" version="1.61.0.v20190602-1335"/>
+ <unit id="org.bouncycastle.bcpkix.source" version="1.61.0.v20190602-1335"/>
+ <unit id="org.bouncycastle.bcprov" version="1.61.0.v20190602-1335"/>
+ <unit id="org.bouncycastle.bcprov.source" version="1.61.0.v20190602-1335"/>
+ <unit id="org.hamcrest" version="1.1.0.v20090501071000"/>
+ <unit id="org.hamcrest.core" version="1.3.0.v20180420-1519"/>
+ <unit id="org.hamcrest.core.source" version="1.3.0.v20180420-1519"/>
+ <unit id="org.hamcrest.library" version="1.3.0.v20180524-2246"/>
+ <unit id="org.hamcrest.library.source" version="1.3.0.v20180524-2246"/>
+ <unit id="org.junit" version="4.12.0.v201504281640"/>
+ <unit id="org.junit.source" version="4.12.0.v201504281640"/>
+ <unit id="org.kohsuke.args4j" version="2.33.0.v20160323-2218"/>
+ <unit id="org.kohsuke.args4j.source" version="2.33.0.v20160323-2218"/>
+ <unit id="org.mockito" version="2.23.0.v20190527-1420"/>
+ <unit id="org.mockito.source" version="2.23.0.v20190527-1420"/>
+ <unit id="org.objenesis" version="2.6.0.v20180420-1519"/>
+ <unit id="org.objenesis.source" version="2.6.0.v20180420-1519"/>
+ <unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
+ <unit id="org.slf4j.api.source" version="1.7.2.v20121108-1250"/>
+ <unit id="org.slf4j.impl.log4j12" version="1.7.2.v20131105-2200"/>
+ <unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
+ <unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
+ <unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
+ </location>
+ <location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
+ <unit id="org.eclipse.osgi" version="0.0.0"/>
+ <repository location="http://download.eclipse.org/releases/2019-09/"/>
+ </location>
+ </locations>
+</target>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd
new file mode 100644
index 0000000000..aaf846d47c
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13.tpd
@@ -0,0 +1,8 @@
+target "jgit-4.13" with source configurePhase
+
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
+
+location "http://download.eclipse.org/releases/2019-09/" {
+ org.eclipse.osgi lazy
+}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target
index 8572d7c45e..e9b21afad5 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.13-staging.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.13-staging" sequenceNumber="1567671414">
+<target name="jgit-4.14-staging" sequenceNumber="1572347844">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,11 +82,11 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
- <repository location="http://download.eclipse.org/staging/2019-09/"/>
+ <repository location="http://download.eclipse.org/staging/2019-12/"/>
</location>
</locations>
</target>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd
new file mode 100644
index 0000000000..92ecfb2f8c
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.14-staging.tpd
@@ -0,0 +1,8 @@
+target "jgit-4.14-staging" with source configurePhase
+
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
+
+location "http://download.eclipse.org/staging/2019-12/" {
+ org.eclipse.osgi lazy
+}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
index e8044e4ed5..f8f44ba607 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.6" sequenceNumber="1567671414">
+<target name="jgit-4.6" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
index edc1983e29..8247dac9f3 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.6.tpd
@@ -1,7 +1,7 @@
target "jgit-4.6" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/neon/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
index 8c6b45bc4e..c3d74ad13d 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.7" sequenceNumber="1567671414">
+<target name="jgit-4.7" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
index 56cb3e9005..f78f6249f2 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.7.tpd
@@ -1,7 +1,7 @@
target "jgit-4.7" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
index f3d8876219..5dddf01e8b 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.8" sequenceNumber="1567671414">
+<target name="jgit-4.8" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
index 9a9b5572a4..ec51621928 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.8.tpd
@@ -1,7 +1,7 @@
target "jgit-4.8" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/photon/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
index 4a6d011e9c..071b361a78 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.target
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="jgit-4.9" sequenceNumber="1567671414">
+<target name="jgit-4.9" sequenceNumber="1572347462">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
- <unit id="org.eclipse.jetty.client" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.client.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.continuation.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.http.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.io.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.security.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.server.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.servlet.source" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util" version="9.4.20.v20190813"/>
- <unit id="org.eclipse.jetty.util.source" version="9.4.20.v20190813"/>
- <repository id="jetty-9.4.20" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/"/>
+ <unit id="org.eclipse.jetty.client" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.client.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.continuation.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.http.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.io.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.security.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.server.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.servlet.source" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util" version="9.4.22.v20191022"/>
+ <unit id="org.eclipse.jetty.util.source" version="9.4.22.v20191022"/>
+ <repository id="jetty-9.4.22" location="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.8.2.v20180104-1110"/>
@@ -39,8 +39,8 @@
<unit id="net.bytebuddy.byte-buddy.source" version="1.9.0.v20181107-1410"/>
<unit id="net.i2p.crypto.eddsa" version="0.3.0.v20181102-1323"/>
<unit id="net.i2p.crypto.eddsa.source" version="0.3.0.v20181102-1323"/>
- <unit id="org.apache.ant" version="1.10.5.v20190526-1402"/>
- <unit id="org.apache.ant.source" version="1.10.5.v20190526-1402"/>
+ <unit id="org.apache.ant" version="1.10.7.v20190926-0324"/>
+ <unit id="org.apache.ant.source" version="1.10.7.v20190926-0324"/>
<unit id="org.apache.commons.codec" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.codec.source" version="1.10.0.v20180409-1845"/>
<unit id="org.apache.commons.compress" version="1.18.0.v20181121-2221"/>
@@ -82,7 +82,7 @@
<unit id="org.slf4j.impl.log4j12.source" version="1.7.2.v20131105-2200"/>
<unit id="org.tukaani.xz" version="1.8.0.v20180207-1613"/>
<unit id="org.tukaani.xz.source" version="1.8.0.v20180207-1613"/>
- <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190827152740/repository"/>
+ <repository location="https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd
index 8874e2e6b0..ec2edff95a 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/jgit-4.9.tpd
@@ -1,7 +1,7 @@
target "jgit-4.9" with source configurePhase
-include "projects/jetty-9.4.20.tpd"
-include "orbit/R20190827152740-2019-09.tpd"
+include "projects/jetty-9.4.22.tpd"
+include "orbit/S20191025144108-2019-12.tpd"
location "http://download.eclipse.org/releases/2018-09/" {
org.eclipse.osgi lazy
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20191025144108-2019-12.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20191025144108-2019-12.tpd
new file mode 100644
index 0000000000..6f858ff5da
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/orbit/S20191025144108-2019-12.tpd
@@ -0,0 +1,65 @@
+target "S20191025144108-2019-12" with source configurePhase
+// see http://download.eclipse.org/tools/orbit/downloads/
+
+location "https://download.eclipse.org/tools/orbit/downloads/drops/S20191025144108/repository" {
+ com.google.gson [2.8.2.v20180104-1110,2.8.2.v20180104-1110]
+ com.google.gson.source [2.8.2.v20180104-1110,2.8.2.v20180104-1110]
+ com.jcraft.jsch [0.1.55.v20190404-1902,0.1.55.v20190404-1902]
+ com.jcraft.jsch.source [0.1.55.v20190404-1902,0.1.55.v20190404-1902]
+ com.jcraft.jzlib [1.1.1.v201205102305,1.1.1.v201205102305]
+ com.jcraft.jzlib.source [1.1.1.v201205102305,1.1.1.v201205102305]
+ javaewah [1.1.6.v20160919-1400,1.1.6.v20160919-1400]
+ javaewah.source [1.1.6.v20160919-1400,1.1.6.v20160919-1400]
+ javax.servlet [3.1.0.v201410161800,3.1.0.v201410161800]
+ javax.servlet.source [3.1.0.v201410161800,3.1.0.v201410161800]
+ net.bytebuddy.byte-buddy [1.9.0.v20181107-1410,1.9.0.v20181107-1410]
+ net.bytebuddy.byte-buddy-agent [1.9.0.v20181106-1534,1.9.0.v20181106-1534]
+ net.bytebuddy.byte-buddy-agent.source [1.9.0.v20181106-1534,1.9.0.v20181106-1534]
+ net.bytebuddy.byte-buddy.source [1.9.0.v20181107-1410,1.9.0.v20181107-1410]
+ net.i2p.crypto.eddsa [0.3.0.v20181102-1323,0.3.0.v20181102-1323]
+ net.i2p.crypto.eddsa.source [0.3.0.v20181102-1323,0.3.0.v20181102-1323]
+ org.apache.ant [1.10.7.v20190926-0324,1.10.7.v20190926-0324]
+ org.apache.ant.source [1.10.7.v20190926-0324,1.10.7.v20190926-0324]
+ org.apache.commons.codec [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
+ org.apache.commons.codec.source [1.10.0.v20180409-1845,1.10.0.v20180409-1845]
+ org.apache.commons.compress [1.18.0.v20181121-2221,1.18.0.v20181121-2221]
+ org.apache.commons.compress.source [1.18.0.v20181121-2221,1.18.0.v20181121-2221]
+ org.apache.commons.logging [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
+ org.apache.commons.logging.source [1.2.0.v20180409-1502,1.2.0.v20180409-1502]
+ org.apache.httpcomponents.httpclient [4.5.6.v20190503-0009,4.5.6.v20190503-0009]
+ org.apache.httpcomponents.httpclient.source [4.5.6.v20190503-0009,4.5.6.v20190503-0009]
+ org.apache.httpcomponents.httpcore [4.4.10.v20190123-2214,4.4.10.v20190123-2214]
+ org.apache.httpcomponents.httpcore.source [4.4.10.v20190123-2214,4.4.10.v20190123-2214]
+ org.apache.log4j [1.2.15.v201012070815,1.2.15.v201012070815]
+ org.apache.log4j.source [1.2.15.v201012070815,1.2.15.v201012070815]
+ org.apache.sshd.osgi [2.2.0.v20190425-2127,2.2.0.v20190425-2127]
+ org.apache.sshd.osgi.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127]
+ org.apache.sshd.sftp [2.2.0.v20190425-2127,2.2.0.v20190425-2127]
+ org.apache.sshd.sftp.source [2.2.0.v20190425-2127,2.2.0.v20190425-2127]
+ org.bouncycastle.bcpg [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.bouncycastle.bcpg.source [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.bouncycastle.bcpkix [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.bouncycastle.bcpkix.source [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.bouncycastle.bcprov [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.bouncycastle.bcprov.source [1.61.0.v20190602-1335,1.61.0.v20190602-1335]
+ org.hamcrest [1.1.0.v20090501071000,1.1.0.v20090501071000]
+ org.hamcrest.core [1.3.0.v20180420-1519,1.3.0.v20180420-1519]
+ org.hamcrest.core.source [1.3.0.v20180420-1519,1.3.0.v20180420-1519]
+ org.hamcrest.library [1.3.0.v20180524-2246,1.3.0.v20180524-2246]
+ org.hamcrest.library.source [1.3.0.v20180524-2246,1.3.0.v20180524-2246]
+ org.junit [4.12.0.v201504281640,4.12.0.v201504281640]
+ org.junit.source [4.12.0.v201504281640,4.12.0.v201504281640]
+ org.kohsuke.args4j [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
+ org.kohsuke.args4j.source [2.33.0.v20160323-2218,2.33.0.v20160323-2218]
+ org.mockito [2.23.0.v20190527-1420,2.23.0.v20190527-1420]
+ org.mockito.source [2.23.0.v20190527-1420,2.23.0.v20190527-1420]
+ org.objenesis [2.6.0.v20180420-1519,2.6.0.v20180420-1519]
+ org.objenesis.source [2.6.0.v20180420-1519,2.6.0.v20180420-1519]
+ org.slf4j.api [1.7.2.v20121108-1250,1.7.2.v20121108-1250]
+ org.slf4j.api.source [1.7.2.v20121108-1250,1.7.2.v20121108-1250]
+ org.slf4j.impl.log4j12 [1.7.2.v20131105-2200,1.7.2.v20131105-2200]
+ org.slf4j.impl.log4j12.source [1.7.2.v20131105-2200,1.7.2.v20131105-2200]
+ org.tukaani.xz [1.8.0.v20180207-1613,1.8.0.v20180207-1613]
+ org.tukaani.xz.source [1.8.0.v20180207-1613,1.8.0.v20180207-1613]
+}
+
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
index c0cf0645e2..e8d9df0467 100644
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/pom.xml
@@ -49,7 +49,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.target</artifactId>
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.20.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.20.tpd
deleted file mode 100644
index b29179a8ec..0000000000
--- a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.20.tpd
+++ /dev/null
@@ -1,20 +0,0 @@
-target "jetty-9.4.20" with source configurePhase
-
-location jetty-9.4.20 "https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.20.v20190813/" {
- org.eclipse.jetty.client [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.client.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.continuation [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.continuation.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.http [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.http.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.io [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.io.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.security [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.security.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.server [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.server.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.servlet [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.servlet.source [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.util [9.4.20.v20190813,9.4.20.v20190813]
- org.eclipse.jetty.util.source [9.4.20.v20190813,9.4.20.v20190813]
-}
diff --git a/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.22.tpd b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.22.tpd
new file mode 100644
index 0000000000..562e017d32
--- /dev/null
+++ b/org.eclipse.jgit.packaging/org.eclipse.jgit.target/projects/jetty-9.4.22.tpd
@@ -0,0 +1,20 @@
+target "jetty-9.4.22" with source configurePhase
+
+location jetty-9.4.22 "https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/9.4.22.v20191022/" {
+ org.eclipse.jetty.client [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.client.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.continuation [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.continuation.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.http [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.http.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.io [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.io.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.security [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.security.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.server [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.server.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.servlet [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.servlet.source [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.util [9.4.22.v20191022,9.4.22.v20191022]
+ org.eclipse.jetty.util.source [9.4.22.v20191022,9.4.22.v20191022]
+}
diff --git a/org.eclipse.jgit.packaging/pom.xml b/org.eclipse.jgit.packaging/pom.xml
index fb4994d61a..47a8030183 100644
--- a/org.eclipse.jgit.packaging/pom.xml
+++ b/org.eclipse.jgit.packaging/pom.xml
@@ -49,13 +49,13 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>jgit.tycho.parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JGit Tycho Parent</name>
<properties>
- <tycho-version>1.4.0</tycho-version>
+ <tycho-version>1.5.1</tycho-version>
<tycho-extras-version>${tycho-version}</tycho-extras-version>
<target-platform>jgit-4.6</target-platform>
</properties>
diff --git a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
index 2cb36e1ff0..fc36051db5 100644
--- a/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm.test/META-INF/MANIFEST.MF
@@ -3,28 +3,28 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.pgm.test
Bundle-SymbolicName: org.eclipse.jgit.pgm.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.diff;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.dircache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="5.5.2",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.merge;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.pgm;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.pgm.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.pgm.opt;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.io;version="[5.5.2,5.6.0)",
+Import-Package: org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.diff;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.dircache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="5.6.0",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.merge;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.pgm;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.pgm.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.pgm.opt;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.io;version="[5.6.0,5.7.0)",
org.hamcrest.core;bundle-version="[1.1.0,2.0.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
diff --git a/org.eclipse.jgit.pgm.test/pom.xml b/org.eclipse.jgit.pgm.test/pom.xml
index 49535d6714..1ba893c7f7 100644
--- a/org.eclipse.jgit.pgm.test/pom.xml
+++ b/org.eclipse.jgit.pgm.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.pgm.test</artifactId>
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
index c31f28c256..0ecbd656ed 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/CloneTest.java
@@ -44,6 +44,7 @@ package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
@@ -54,7 +55,13 @@ import org.eclipse.jgit.junit.JGitTestUtil;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.RefUpdate;
+import org.eclipse.jgit.lib.StoredConfig;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.transport.RefSpec;
+import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
@@ -90,10 +97,10 @@ public class CloneTest extends CLIRepositoryTestCase {
assertEquals("expected 1 branch", 1, branches.size());
}
- private void createInitialCommit() throws Exception {
+ private RevCommit createInitialCommit() throws Exception {
JGitTestUtil.writeTrashFile(db, "hello.txt", "world");
git.add().addFilepattern("hello.txt").call();
- git.commit().setMessage("Initial commit").call();
+ return git.commit().setMessage("Initial commit").call();
}
@Test
@@ -154,4 +161,37 @@ public class CloneTest extends CLIRepositoryTestCase {
assertEquals("expected 1 branch", 1, branches.size());
assertTrue("expected bare repository", git2.getRepository().isBare());
}
+
+ @Test
+ public void testCloneMirror() throws Exception {
+ ObjectId head = createInitialCommit();
+ // create a non-standard ref
+ RefUpdate ru = db.updateRef("refs/meta/foo/bar");
+ ru.setNewObjectId(head);
+ ru.update();
+
+ File gitDir = db.getDirectory();
+ String sourcePath = gitDir.getAbsolutePath();
+ String targetPath = (new File(sourcePath)).getParentFile()
+ .getParentFile().getAbsolutePath() + File.separator
+ + "target.git";
+ String cmd = "git clone --mirror " + shellQuote(sourcePath) + " "
+ + shellQuote(targetPath);
+ String[] result = execute(cmd);
+ assertArrayEquals(
+ new String[] { "Cloning into '" + targetPath + "'...", "", "" },
+ result);
+ Git git2 = Git.open(new File(targetPath));
+ List<Ref> branches = git2.branchList().call();
+ assertEquals("expected 1 branch", 1, branches.size());
+ assertTrue("expected bare repository", git2.getRepository().isBare());
+ StoredConfig config = git2.getRepository().getConfig();
+ RemoteConfig rc = new RemoteConfig(config, "origin");
+ assertTrue("expected mirror configuration", rc.isMirror());
+ RefSpec fetchRefSpec = rc.getFetchRefSpecs().get(0);
+ assertTrue("exected force udpate", fetchRefSpec.isForceUpdate());
+ assertEquals("refs/*", fetchRefSpec.getSource());
+ assertEquals("refs/*", fetchRefSpec.getDestination());
+ assertNotNull(git2.getRepository().exactRef("refs/meta/foo/bar"));
+ }
}
diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
index ef6f5e732f..bc7ba1e50e 100644
--- a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
index 0a9074a2cf..48dc730011 100644
--- a/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.pgm/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.pgm
Bundle-SymbolicName: org.eclipse.jgit.pgm
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
@@ -28,50 +28,50 @@ Import-Package: javax.servlet;version="[3.1.0,4.0.0)",
org.eclipse.jetty.util.log;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.security;version="[9.4.5,10.0.0)",
org.eclipse.jetty.util.thread;version="[9.4.5,10.0.0)",
- org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.archive;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.awtui;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.blame;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.diff;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.dircache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.gitrepo;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.ketch;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.io;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.reftree;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.server;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.server.fs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs.server.s3;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.merge;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.notes;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revplot;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http.apache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.resolver;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.sshd;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.io;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.archive;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.awtui;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.blame;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.diff;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.dircache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.gitrepo;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.ketch;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.io;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.reftree;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.server;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.server.fs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs.server.s3;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.merge;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.notes;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revplot;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http.apache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.sshd;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.io;version="[5.6.0,5.7.0)",
org.kohsuke.args4j;version="[2.33.0,3.0.0)",
org.kohsuke.args4j.spi;version="[2.33.0,3.0.0)"
-Export-Package: org.eclipse.jgit.console;version="5.5.2";
+Export-Package: org.eclipse.jgit.console;version="5.6.0";
uses:="org.eclipse.jgit.transport,
org.eclipse.jgit.util",
- org.eclipse.jgit.pgm;version="5.5.2";
+ org.eclipse.jgit.pgm;version="5.6.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.pgm.opt,
@@ -82,11 +82,11 @@ Export-Package: org.eclipse.jgit.console;version="5.5.2";
org.eclipse.jgit.treewalk,
javax.swing,
org.eclipse.jgit.transport",
- org.eclipse.jgit.pgm.debug;version="5.5.2";
+ org.eclipse.jgit.pgm.debug;version="5.6.0";
uses:="org.eclipse.jgit.util.io,
org.eclipse.jgit.pgm",
- org.eclipse.jgit.pgm.internal;version="5.5.2";x-friends:="org.eclipse.jgit.pgm.test,org.eclipse.jgit.test",
- org.eclipse.jgit.pgm.opt;version="5.5.2";
+ org.eclipse.jgit.pgm.internal;version="5.6.0";x-friends:="org.eclipse.jgit.pgm.test,org.eclipse.jgit.test",
+ org.eclipse.jgit.pgm.opt;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.kohsuke.args4j.spi,
diff --git a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
index 1ce53a586f..70aa5003dd 100644
--- a/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.pgm/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.pgm - Sources
Bundle-SymbolicName: org.eclipse.jgit.pgm.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.pgm;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml
index c7bcaf1e6c..003076fd98 100644
--- a/org.eclipse.jgit.pgm/pom.xml
+++ b/org.eclipse.jgit.pgm/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.pgm</artifactId>
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index f02944265a..7cca02376b 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -223,6 +223,9 @@ updating=Updating {0}..{1}
usage_Aggressive=This option will cause gc to more aggressively optimize the repository at the expense of taking much more time
usage_AlwaysFallback=Show uniquely abbreviated commit object as fallback
usage_bareClone=Make a bare Git repository. That is, instead of creating [DIRECTORY] and placing the administrative files in [DIRECTORY]/.git, make the [DIRECTORY] itself the $GIT_DIR.
+usage_mirrorClone=Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps \
+local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) \
+and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.
usage_Blame=Show what revision and author last modified each line
usage_Clean=Remove untracked files from the working tree
usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
index f8442facb7..039d0946b2 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/console/ConsoleCredentialsProvider.java
@@ -136,18 +136,15 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
if (v != null) {
item.setValue(new String(v));
return true;
- } else {
- return false;
- }
- } else {
- String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
- if (v != null) {
- item.setValue(v);
- return true;
- } else {
- return false;
}
+ return false;
+ }
+ String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
+ if (v != null) {
+ item.setValue(v);
+ return true;
}
+ return false;
}
private boolean get(CredentialItem.CharArrayType item) {
@@ -156,18 +153,15 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
if (v != null) {
item.setValueNoCopy(v);
return true;
- } else {
- return false;
- }
- } else {
- String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
- if (v != null) {
- item.setValueNoCopy(v.toCharArray());
- return true;
- } else {
- return false;
}
+ return false;
+ }
+ String v = cons.readLine("%s: ", item.getPromptText()); //$NON-NLS-1$
+ if (v != null) {
+ item.setValueNoCopy(v.toCharArray());
+ return true;
}
+ return false;
}
private boolean get(CredentialItem.InformationalMessage item) {
@@ -182,8 +176,7 @@ public class ConsoleCredentialsProvider extends CredentialsProvider {
if (r != null) {
item.setValue(CLIText.get().answerYes.equalsIgnoreCase(r));
return true;
- } else {
- return false;
}
+ return false;
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
index fe2462012b..a6a031e2c7 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
@@ -74,6 +74,9 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
@Option(name = "--bare", usage = "usage_bareClone")
private boolean isBare;
+ @Option(name = "--mirror", usage = "usage_mirrorClone")
+ private boolean isMirror;
+
@Option(name = "--quiet", usage = "usage_quiet")
private Boolean quiet;
@@ -103,7 +106,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
if (localName == null) {
try {
localName = uri.getHumanishName();
- if (isBare) {
+ if (isBare || isMirror) {
localName = localName + Constants.DOT_GIT_EXT;
}
localNameF = new File(SystemReader.getInstance().getProperty(
@@ -120,6 +123,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
CloneCommand command = Git.cloneRepository();
command.setURI(sourceUri).setRemote(remoteName).setBare(isBare)
+ .setMirror(isMirror)
.setNoCheckout(noCheckout).setBranch(branch)
.setCloneSubmodules(cloneSubmodules);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
index c3887fe9c3..23ee9337b6 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
@@ -306,8 +306,8 @@ class Status extends TextBuiltin {
}
outw.flush();
return list.size();
- } else
- return 0;
+ }
+ return 0;
}
/**
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
index 8948c27537..0d30f3661c 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
@@ -189,9 +189,8 @@ class RebuildCommitGraph extends TextBuiltin {
// rewritten.
queue.add(t);
continue REWRITE;
- } else {
- newParents[k] = p.newId;
}
+ newParents[k] = p.newId;
} else {
// We have the old parent object. Use it.
//
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
index a2ea8c20b4..1242bb754b 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
@@ -138,9 +138,8 @@ class TextHashFunctions extends TextBuiltin {
Arrays.fill(buf16, (byte) 0);
System.arraycopy(raw, ptr, buf16, 0, end - ptr);
return rabin(buf16, 0);
- } else {
- return rabin(raw, ptr);
}
+ return rabin(raw, ptr);
}
private int rabin(byte[] raw, int ptr) {
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
index 6cbc1b082b..0320ed1174 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/WriteReftable.java
@@ -128,9 +128,9 @@ class WriteReftable extends TextBuiltin {
cfg.setMaxIndexLevels(indexLevels);
}
- ReftableWriter w = new ReftableWriter(cfg);
+ ReftableWriter w = new ReftableWriter(cfg, os);
w.setMinUpdateIndex(min(logs)).setMaxUpdateIndex(max(logs));
- w.begin(os);
+ w.begin();
w.sortAndWriteRefs(refs);
for (LogEntry e : logs) {
w.writeLog(e.ref, e.updateIndex, e.who,
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
index b97aa5b7af..d3aa38cf23 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
@@ -299,10 +299,10 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
/** {@inheritDoc} */
@Override
protected OptionHandler createOptionHandler(OptionDef o, Setter setter) {
- if (o instanceof NamedOptionDef)
+ if (o instanceof NamedOptionDef) {
return super.createOptionHandler(o, setter);
- else
- return super.createOptionHandler(new MyOptionDef(o), setter);
+ }
+ return super.createOptionHandler(new MyOptionDef(o), setter);
}
diff --git a/org.eclipse.jgit.ssh.apache.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ssh.apache.test/.settings/org.eclipse.jdt.core.prefs
index 794592dee1..822846c4d0 100644
--- a/org.eclipse.jgit.ssh.apache.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ssh.apache.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF
index 81969e723f..4bae3d9b6e 100644
--- a/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ssh.apache.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.ssh.apache.test
Bundle-SymbolicName: org.eclipse.jgit.ssh.apache.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
@@ -15,15 +15,15 @@ Import-Package: org.apache.sshd.client.config.hosts;version="[2.2.0,2.3.0)",
org.apache.sshd.common.session;version="[2.2.0,2.3.0)",
org.apache.sshd.common.util.net;version="[2.2.0,2.3.0)",
org.apache.sshd.common.util.security;version="[2.2.0,2.3.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.transport.sshd.proxy;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit.ssh;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.ssh;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.sshd;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.transport.sshd.proxy;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit.ssh;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.ssh;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.sshd;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.experimental.theories;version="[4.12,5.0.0)",
org.junit.runner;version="[4.12,5.0.0)"
diff --git a/org.eclipse.jgit.ssh.apache.test/pom.xml b/org.eclipse.jgit.ssh.apache.test/pom.xml
index 0f2504c84f..838fd83f6d 100644
--- a/org.eclipse.jgit.ssh.apache.test/pom.xml
+++ b/org.eclipse.jgit.ssh.apache.test/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ssh.apache.test</artifactId>
diff --git a/org.eclipse.jgit.ssh.apache/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ssh.apache/.settings/org.eclipse.jdt.core.prefs
index 13c32a6d94..15ef2aad5d 100644
--- a/org.eclipse.jgit.ssh.apache/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ssh.apache/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF b/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF
index 6a11b18976..209a10f491 100644
--- a/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ssh.apache/META-INF/MANIFEST.MF
@@ -6,9 +6,9 @@ Bundle-SymbolicName: org.eclipse.jgit.ssh.apache
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.jgit.internal.transport.sshd;version="5.5.2";x-internal:=true;
+Export-Package: org.eclipse.jgit.internal.transport.sshd;version="5.6.0";x-internal:=true;
uses:="org.apache.sshd.client,
org.apache.sshd.client.auth,
org.apache.sshd.client.auth.keyboard,
@@ -23,9 +23,9 @@ Export-Package: org.eclipse.jgit.internal.transport.sshd;version="5.5.2";x-inter
org.apache.sshd.common.signature,
org.apache.sshd.common.util.buffer,
org.eclipse.jgit.transport",
- org.eclipse.jgit.internal.transport.sshd.auth;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.internal.transport.sshd.proxy;version="5.5.2";x-friends:="org.eclipse.jgit.ssh.apache.test",
- org.eclipse.jgit.transport.sshd;version="5.5.2";
+ org.eclipse.jgit.internal.transport.sshd.auth;version="5.6.0";x-internal:=true,
+ org.eclipse.jgit.internal.transport.sshd.proxy;version="5.6.0";x-friends:="org.eclipse.jgit.ssh.apache.test",
+ org.eclipse.jgit.transport.sshd;version="5.6.0";
uses:="org.eclipse.jgit.transport,
org.apache.sshd.client.config.hosts,
org.apache.sshd.common.keyprovider,
@@ -75,12 +75,12 @@ Import-Package: net.i2p.crypto.eddsa;version="[0.3.0,0.4.0)",
org.apache.sshd.common.util.net;version="[2.2.0,2.3.0)",
org.apache.sshd.common.util.security;version="[2.2.0,2.3.0)",
org.apache.sshd.server.auth;version="[2.2.0,2.3.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.fnmatch;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.transport.ssh;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.fnmatch;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.transport.ssh;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
org.slf4j;version="[1.7.0,2.0.0)"
diff --git a/org.eclipse.jgit.ssh.apache/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.ssh.apache/META-INF/SOURCE-MANIFEST.MF
index 8991b5b608..c1d8d9a29a 100644
--- a/org.eclipse.jgit.ssh.apache/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.ssh.apache/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.ssh.apache - Sources
Bundle-SymbolicName: org.eclipse.jgit.ssh.apache.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.ssh.apache;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.ssh.apache;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.ssh.apache/pom.xml b/org.eclipse.jgit.ssh.apache/pom.xml
index f412d63fb7..26e44b085d 100644
--- a/org.eclipse.jgit.ssh.apache/pom.xml
+++ b/org.eclipse.jgit.ssh.apache/pom.xml
@@ -50,7 +50,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ssh.apache</artifactId>
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
index 1954abc75b..79bd3faa01 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitClientSession.java
@@ -179,9 +179,8 @@ public class JGitClientSession extends ClientSessionImpl {
} catch (Exception other) {
throw new IOException(other.getLocalizedMessage(), other);
}
- } else {
- return super.sendIdentification(ident);
}
+ return super.sendIdentification(ident);
}
@Override
@@ -205,9 +204,8 @@ public class JGitClientSession extends ClientSessionImpl {
} catch (Exception other) {
throw new IOException(other.getLocalizedMessage(), other);
}
- } else {
- return super.sendKexInit();
}
+ return super.sendKexInit();
}
/**
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java
index f4849ce4a3..9c0a793124 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java
@@ -453,9 +453,8 @@ public class OpenSshServerKeyDatabase
prompt);
items.add(answer);
return provider.get(uri, items) && answer.getValue();
- } else {
- return provider.get(uri, items);
}
+ return provider.get(uri, items);
}
private Check checkMode(SocketAddress remoteAddress, boolean changed) {
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
index b9b32b1300..02771b501c 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/HttpParser.java
@@ -207,11 +207,10 @@ public final class HttpParser {
next++;
}
return next;
- } else {
- // This token must be the name of the next authentication
- // scheme.
- return start;
}
+ // This token must be the name of the next authentication
+ // scheme.
+ return start;
}
int nextStart = skipWhiteSpace(header, next + 1);
if (nextStart >= length) {
@@ -244,11 +243,10 @@ public final class HttpParser {
// token, and the equals sign is part of the token
challenge.setToken(header.substring(start, end + 1));
return nextStart + 1;
- } else {
- // Key without value...
- challenge.addArgument(header.substring(start, end), null);
- start = nextStart + 1;
}
+ // Key without value...
+ challenge.addArgument(header.substring(start, end), null);
+ start = nextStart + 1;
} else {
if (header.charAt(nextStart) == '"') {
int nextEnd[] = { nextStart + 1 };
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
index 27d6f418b8..b3681d14a5 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/proxy/Socks5ClientConnector.java
@@ -281,11 +281,10 @@ public class Socks5ClientConnector extends AbstractClientProxyConnector {
}
if (i == proposals.length) {
return proposals;
- } else {
- byte[] result = new byte[i];
- System.arraycopy(proposals, 0, result, 0, i);
- return result;
}
+ byte[] result = new byte[i];
+ System.arraycopy(proposals, 0, result, 0, i);
+ return result;
}
private void sendConnectInfo(IoSession session) throws Exception {
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
index 1e8d7d1e1e..3fc955ab25 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
@@ -354,9 +354,8 @@ public class SshdSession implements RemoteSession {
if (path.charAt(0) != '/') {
if (cwd.charAt(cwd.length() - 1) == '/') {
return cwd + path;
- } else {
- return cwd + '/' + path;
}
+ return cwd + '/' + path;
}
return path;
}
diff --git a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
index 2ca78ff2d0..3dd5840397 100644
--- a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
diff --git a/org.eclipse.jgit.test/BUILD b/org.eclipse.jgit.test/BUILD
index 3f664f93f3..3d487960c4 100644
--- a/org.eclipse.jgit.test/BUILD
+++ b/org.eclipse.jgit.test/BUILD
@@ -24,6 +24,7 @@ HELPERS = glob(
"revwalk/RevQueueTestCase.java",
"revwalk/RevWalkTestCase.java",
"transport/ObjectIdMatcher.java",
+ "transport/RequestValidatorTestCase.java",
"transport/SpiTransport.java",
"treewalk/filter/AlwaysCloneTreeFilter.java",
"test/resources/SampleDataRepositoryTestCase.java",
diff --git a/org.eclipse.jgit.test/META-INF/MANIFEST.MF b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
index 42c9c573a9..8043065389 100644
--- a/org.eclipse.jgit.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.test/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.test
Bundle-SymbolicName: org.eclipse.jgit.test
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
@@ -18,57 +18,58 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
org.apache.commons.compress.compressors.gzip;version="[1.15.0,2.0)",
org.apache.commons.compress.compressors.xz;version="[1.15.0,2.0)",
org.bouncycastle.util.encoders;version="[1.61.0,2.0.0)",
- org.eclipse.jgit.annotations;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.api.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.archive;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.attributes;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.awtui;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.blame;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.diff;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.dircache;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.events;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.fnmatch;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.gitrepo;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.hooks;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.ignore;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.ignore.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.fsck;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.dfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.io;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.reftable;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.storage.reftree;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.internal.transport.parser;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit.ssh;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.junit.time;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lfs;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.merge;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.notes;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.patch;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.pgm;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.pgm.internal;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revplot;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.file;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.storage.pack;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.submodule;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.http;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport.resolver;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.treewalk.filter;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.io;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util.sha1;version="[5.5.2,5.6.0)",
+ org.eclipse.jgit.annotations;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.api.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.archive;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.attributes;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.awtui;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.blame;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.diff;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.dircache;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.events;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.fnmatch;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.gitrepo;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.hooks;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.ignore;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.ignore.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.fsck;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.dfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.io;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.reftable;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.storage.reftree;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.internal.transport.parser;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit.ssh;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.junit.time;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lfs;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.merge;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.notes;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.patch;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.pgm;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.pgm.internal;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revplot;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.file;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.storage.pack;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.submodule;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.http;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport.resolver;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.treewalk.filter;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.io;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util.sha1;version="[5.6.0,5.7.0)",
org.junit;version="[4.12,5.0.0)",
org.junit.experimental.theories;version="[4.12,5.0.0)",
org.junit.rules;version="[4.12,5.0.0)",
@@ -83,4 +84,4 @@ Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
org.tukaani.xz;version="[1.6.0,2.0)"
Require-Bundle: org.hamcrest.core;bundle-version="[1.1.0,2.0.0)",
org.hamcrest.library;bundle-version="[1.1.0,2.0.0)"
-Export-Package: org.eclipse.jgit.transport.ssh;version="5.5.2";x-friends:="org.eclipse.jgit.ssh.apache.test"
+Export-Package: org.eclipse.jgit.transport.ssh;version="5.6.0";x-friends:="org.eclipse.jgit.ssh.apache.test"
diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml
index 91c3418b1b..d8af7dc524 100644
--- a/org.eclipse.jgit.test/pom.xml
+++ b/org.eclipse.jgit.test/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.test</artifactId>
diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
index 228df35c76..e1f6b12258 100644
--- a/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
+++ b/org.eclipse.jgit.test/src/org/eclipse/jgit/events/ChangeRecorder.java
@@ -43,7 +43,6 @@
package org.eclipse.jgit.events;
-import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import java.util.Arrays;
@@ -99,10 +98,12 @@ public class ChangeRecorder implements WorkingTreeModifiedListener {
Arrays.sort(expectedModified);
Arrays.sort(actuallyDeleted);
Arrays.sort(expectedDeleted);
- assertArrayEquals("Unexpected modifications reported", expectedModified,
- actuallyModified);
- assertArrayEquals("Unexpected deletions reported", expectedDeleted,
- actuallyDeleted);
+ assertEquals("Unexpected modifications reported",
+ Arrays.toString(expectedModified),
+ Arrays.toString(actuallyModified));
+ assertEquals("Unexpected deletions reported",
+ Arrays.toString(expectedDeleted),
+ Arrays.toString(actuallyDeleted));
reset();
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
index b28e26a639..52a9dfa3e2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
@@ -700,26 +700,26 @@ public class AddCommandTest extends RepositoryTestCase {
writer.print("content b");
}
- ObjectInserter newObjectInserter = db.newObjectInserter();
DirCache dc = db.lockDirCache();
- DirCacheBuilder builder = dc.builder();
+ try (ObjectInserter newObjectInserter = db.newObjectInserter()) {
+ DirCacheBuilder builder = dc.builder();
- addEntryToBuilder("b.txt", file2, newObjectInserter, builder, 0);
- addEntryToBuilder("a.txt", file, newObjectInserter, builder, 1);
+ addEntryToBuilder("b.txt", file2, newObjectInserter, builder, 0);
+ addEntryToBuilder("a.txt", file, newObjectInserter, builder, 1);
- try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
- writer.print("other content");
- }
- addEntryToBuilder("a.txt", file, newObjectInserter, builder, 3);
-
- try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
- writer.print("our content");
- }
- addEntryToBuilder("a.txt", file, newObjectInserter, builder, 2)
- .getObjectId();
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
+ writer.print("other content");
+ }
+ addEntryToBuilder("a.txt", file, newObjectInserter, builder, 3);
- builder.commit();
+ try (PrintWriter writer = new PrintWriter(file, UTF_8.name())) {
+ writer.print("our content");
+ }
+ addEntryToBuilder("a.txt", file, newObjectInserter, builder, 2)
+ .getObjectId();
+ builder.commit();
+ }
assertEquals(
"[a.txt, mode:100644, stage:1, content:content]" +
"[a.txt, mode:100644, stage:2, content:our content]" +
@@ -1132,41 +1132,42 @@ public class AddCommandTest extends RepositoryTestCase {
}
};
- Git git = Git.open(db.getDirectory(), executableFs);
String path = "a.txt";
String path2 = "a.sh";
writeTrashFile(path, "content");
writeTrashFile(path2, "binary: content");
- git.add().addFilepattern(path).addFilepattern(path2).call();
- RevCommit commit1 = git.commit().setMessage("commit").call();
- try (TreeWalk walk = new TreeWalk(db)) {
- walk.addTree(commit1.getTree());
- walk.next();
- assertEquals(path2, walk.getPathString());
- assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
- walk.next();
- assertEquals(path, walk.getPathString());
- assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0));
+ try (Git git = Git.open(db.getDirectory(), executableFs)) {
+ git.add().addFilepattern(path).addFilepattern(path2).call();
+ RevCommit commit1 = git.commit().setMessage("commit").call();
+ try (TreeWalk walk = new TreeWalk(db)) {
+ walk.addTree(commit1.getTree());
+ walk.next();
+ assertEquals(path2, walk.getPathString());
+ assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ walk.next();
+ assertEquals(path, walk.getPathString());
+ assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0));
+ }
}
-
config = db.getConfig();
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_FILEMODE, false);
config.save();
- Git git2 = Git.open(db.getDirectory(), executableFs);
writeTrashFile(path2, "content2");
writeTrashFile(path, "binary: content2");
- git2.add().addFilepattern(path).addFilepattern(path2).call();
- RevCommit commit2 = git2.commit().setMessage("commit2").call();
- try (TreeWalk walk = new TreeWalk(db)) {
- walk.addTree(commit2.getTree());
- walk.next();
- assertEquals(path2, walk.getPathString());
- assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
- walk.next();
- assertEquals(path, walk.getPathString());
- assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0));
+ try (Git git2 = Git.open(db.getDirectory(), executableFs)) {
+ git2.add().addFilepattern(path).addFilepattern(path2).call();
+ RevCommit commit2 = git2.commit().setMessage("commit2").call();
+ try (TreeWalk walk = new TreeWalk(db)) {
+ walk.addTree(commit2.getTree());
+ walk.next();
+ assertEquals(path2, walk.getPathString());
+ assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ walk.next();
+ assertEquals(path, walk.getPathString());
+ assertEquals(FileMode.REGULAR_FILE, walk.getFileMode(0));
+ }
}
}
@@ -1291,18 +1292,19 @@ public class AddCommandTest extends RepositoryTestCase {
FileRepositoryBuilder nestedBuilder = new FileRepositoryBuilder();
nestedBuilder.setWorkTree(gitLinkDir);
- Repository nestedRepo = nestedBuilder.build();
- nestedRepo.create();
+ try (Repository nestedRepo = nestedBuilder.build()) {
+ nestedRepo.create();
- writeTrashFile(path, "README1.md", "content");
- writeTrashFile(path, "README2.md", "content");
+ writeTrashFile(path, "README1.md", "content");
+ writeTrashFile(path, "README2.md", "content");
- // Commit these changes in the subrepo
- try (Git git = new Git(nestedRepo)) {
- git.add().addFilepattern(".").call();
- git.commit().setMessage("subrepo commit").call();
- } catch (GitAPIException e) {
- throw new RuntimeException(e);
+ // Commit these changes in the subrepo
+ try (Git git = new Git(nestedRepo)) {
+ git.add().addFilepattern(".").call();
+ git.commit().setMessage("subrepo commit").call();
+ } catch (GitAPIException e) {
+ throw new RuntimeException(e);
+ }
}
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
index fbc2cf67e1..76958f1ddf 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java
@@ -58,6 +58,8 @@ import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException;
import org.eclipse.jgit.dircache.DirCache;
+import org.eclipse.jgit.events.ChangeRecorder;
+import org.eclipse.jgit.events.ListenerHandle;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
@@ -325,6 +327,59 @@ public class CherryPickCommandTest extends RepositoryTestCase {
}
@Test
+ public void testCherryPickConflictFiresModifiedEvent() throws Exception {
+ ListenerHandle listener = null;
+ try (Git git = new Git(db)) {
+ RevCommit sideCommit = prepareCherryPick(git);
+ ChangeRecorder recorder = new ChangeRecorder();
+ listener = db.getListenerList()
+ .addWorkingTreeModifiedListener(recorder);
+ CherryPickResult result = git.cherryPick()
+ .include(sideCommit.getId()).call();
+ assertEquals(CherryPickStatus.CONFLICTING, result.getStatus());
+ recorder.assertEvent(new String[] { "a" }, ChangeRecorder.EMPTY);
+ } finally {
+ if (listener != null) {
+ listener.remove();
+ }
+ }
+ }
+
+ @Test
+ public void testCherryPickNewFileFiresModifiedEvent() throws Exception {
+ ListenerHandle listener = null;
+ try (Git git = new Git(db)) {
+ writeTrashFile("test.txt", "a");
+ git.add().addFilepattern("test.txt").call();
+ git.commit().setMessage("commit1").call();
+ git.checkout().setCreateBranch(true).setName("a").call();
+
+ writeTrashFile("side.txt", "side");
+ git.add().addFilepattern("side.txt").call();
+ RevCommit side = git.commit().setMessage("side").call();
+ assertNotNull(side);
+
+ assertNotNull(git.checkout().setName(Constants.MASTER).call());
+ writeTrashFile("test.txt", "b");
+ assertNotNull(git.add().addFilepattern("test.txt").call());
+ assertNotNull(git.commit().setMessage("commit2").call());
+
+ ChangeRecorder recorder = new ChangeRecorder();
+ listener = db.getListenerList()
+ .addWorkingTreeModifiedListener(recorder);
+ CherryPickResult result = git.cherryPick()
+ .include(side.getId()).call();
+ assertEquals(CherryPickStatus.OK, result.getStatus());
+ recorder.assertEvent(new String[] { "side.txt" },
+ ChangeRecorder.EMPTY);
+ } finally {
+ if (listener != null) {
+ listener.remove();
+ }
+ }
+ }
+
+ @Test
public void testCherryPickOurCommitName() throws Exception {
try (Git git = new Git(db)) {
RevCommit sideCommit = prepareCherryPick(git);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
index 2270a6a8be..3224bbb784 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
@@ -67,6 +67,7 @@ import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevBlob;
@@ -96,10 +97,15 @@ public class CloneCommandTest extends RepositoryTestCase {
writeTrashFile("Test.txt", "Hello world");
git.add().addFilepattern("Test.txt").call();
git.commit().setMessage("Initial commit").call();
- git.tag().setName("tag-initial").setMessage("Tag initial").call();
+ Ref head = git.tag().setName("tag-initial").setMessage("Tag initial")
+ .call();
// create a test branch and switch to it
git.checkout().setCreateBranch(true).setName("test").call();
+ // create a non-standard ref
+ RefUpdate ru = db.updateRef("refs/meta/foo/bar");
+ ru.setNewObjectId(head.getObjectId());
+ ru.update();
// commit something on the test branch
writeTrashFile("Test.txt", "Some change");
@@ -397,7 +403,6 @@ public class CloneCommandTest extends RepositoryTestCase {
@Test
public void testBareCloneRepositoryOnlyOneBranch() throws Exception {
- // Same thing, but now test with bare repo
File directory = createTempDirectory(
"testCloneRepositoryWithBranch_bare");
CloneCommand command = Git.cloneRepository();
@@ -425,6 +430,32 @@ public class CloneCommandTest extends RepositoryTestCase {
}
@Test
+ public void testBareCloneRepositoryMirror() throws Exception {
+ File directory = createTempDirectory(
+ "testCloneRepositoryWithBranch_mirror");
+ CloneCommand command = Git.cloneRepository();
+ command.setBranch("refs/heads/master");
+ command.setMirror(true); // implies bare repository
+ command.setDirectory(directory);
+ command.setURI(fileUri());
+ Git git2 = command.call();
+ addRepoToClose(git2.getRepository());
+ assertNotNull(git2);
+ assertNotNull(git2.getRepository().resolve("tag-for-blob"));
+ assertNotNull(git2.getRepository().resolve("tag-initial"));
+ assertEquals(git2.getRepository().getFullBranch(), "refs/heads/master");
+ assertEquals("refs/heads/master, refs/heads/test", allRefNames(
+ git2.branchList().setListMode(ListMode.ALL).call()));
+ assertNotNull(git2.getRepository().exactRef("refs/meta/foo/bar"));
+ RemoteConfig cfg = new RemoteConfig(git2.getRepository().getConfig(),
+ Constants.DEFAULT_REMOTE_NAME);
+ List<RefSpec> specs = cfg.getFetchRefSpecs();
+ assertEquals(1, specs.size());
+ assertEquals(new RefSpec("+refs/*:refs/*"),
+ specs.get(0));
+ }
+
+ @Test
public void testCloneRepositoryOnlyOneTag() throws Exception {
File directory = createTempDirectory("testCloneRepositoryWithBranch");
CloneCommand command = Git.cloneRepository();
@@ -646,25 +677,27 @@ public class CloneCommandTest extends RepositoryTestCase {
assertEquals(sub1Head, pathStatus.getHeadId());
assertEquals(sub1Head, pathStatus.getIndexId());
- SubmoduleWalk walk = SubmoduleWalk.forIndex(git2.getRepository());
- assertTrue(walk.next());
- try (Repository clonedSub1 = walk.getRepository()) {
- assertNotNull(clonedSub1);
- assertEquals(new File(git2.getRepository().getWorkTree(),
- walk.getPath()), clonedSub1.getWorkTree());
- assertEquals(
- new File(new File(git2.getRepository().getDirectory(),
- "modules"), walk.getPath()),
- clonedSub1.getDirectory());
- status = new SubmoduleStatusCommand(clonedSub1);
- statuses = status.call();
+ try (SubmoduleWalk walk = SubmoduleWalk
+ .forIndex(git2.getRepository())) {
+ assertTrue(walk.next());
+ try (Repository clonedSub1 = walk.getRepository()) {
+ assertNotNull(clonedSub1);
+ assertEquals(new File(git2.getRepository().getWorkTree(),
+ walk.getPath()), clonedSub1.getWorkTree());
+ assertEquals(
+ new File(new File(git2.getRepository().getDirectory(),
+ "modules"), walk.getPath()),
+ clonedSub1.getDirectory());
+ status = new SubmoduleStatusCommand(clonedSub1);
+ statuses = status.call();
+ }
+ assertFalse(walk.next());
}
pathStatus = statuses.get(path);
assertNotNull(pathStatus);
assertEquals(SubmoduleStatusType.INITIALIZED, pathStatus.getType());
assertEquals(sub2Head, pathStatus.getHeadId());
assertEquals(sub2Head, pathStatus.getIndexId());
- assertFalse(walk.next());
}
@Test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
index 3bde0eb33f..b5661e8440 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java
@@ -148,9 +148,10 @@ public class CommitCommandTest extends RepositoryTestCase {
writeTrashFile(path, "content");
git.add().addFilepattern(path).call();
RevCommit commit1 = git.commit().setMessage("commit").call();
- TreeWalk walk = TreeWalk.forPath(db, path, commit1.getTree());
- assertNotNull(walk);
- assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ try (TreeWalk walk = TreeWalk.forPath(db, path, commit1.getTree())) {
+ assertNotNull(walk);
+ assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ }
FS nonExecutableFs = new FS() {
@@ -204,9 +205,10 @@ public class CommitCommandTest extends RepositoryTestCase {
writeTrashFile(path, "content2");
RevCommit commit2 = git2.commit().setOnly(path).setMessage("commit2")
.call();
- walk = TreeWalk.forPath(db, path, commit2.getTree());
- assertNotNull(walk);
- assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ try (TreeWalk walk = TreeWalk.forPath(db, path, commit2.getTree())) {
+ assertNotNull(walk);
+ assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0));
+ }
}
@Test
@@ -225,15 +227,16 @@ public class CommitCommandTest extends RepositoryTestCase {
assertNotNull(repo);
addRepoToClose(repo);
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(path, generator.getPath());
- assertEquals(commit, generator.getObjectId());
- assertEquals(uri, generator.getModulesUrl());
- assertEquals(path, generator.getModulesPath());
- assertEquals(uri, generator.getConfigUrl());
- try (Repository subModRepo = generator.getRepository()) {
- assertNotNull(subModRepo);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(path, generator.getPath());
+ assertEquals(commit, generator.getObjectId());
+ assertEquals(uri, generator.getModulesUrl());
+ assertEquals(path, generator.getModulesPath());
+ assertEquals(uri, generator.getConfigUrl());
+ try (Repository subModRepo = generator.getRepository()) {
+ assertNotNull(subModRepo);
+ }
}
assertEquals(commit, repo.resolve(Constants.HEAD));
@@ -275,15 +278,16 @@ public class CommitCommandTest extends RepositoryTestCase {
assertNotNull(repo);
addRepoToClose(repo);
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(path, generator.getPath());
- assertEquals(commit2, generator.getObjectId());
- assertEquals(uri, generator.getModulesUrl());
- assertEquals(path, generator.getModulesPath());
- assertEquals(uri, generator.getConfigUrl());
- try (Repository subModRepo = generator.getRepository()) {
- assertNotNull(subModRepo);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(path, generator.getPath());
+ assertEquals(commit2, generator.getObjectId());
+ assertEquals(uri, generator.getModulesUrl());
+ assertEquals(path, generator.getModulesPath());
+ assertEquals(uri, generator.getConfigUrl());
+ try (Repository subModRepo = generator.getRepository()) {
+ assertNotNull(subModRepo);
+ }
}
assertEquals(commit2, repo.resolve(Constants.HEAD));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
index 47806cb99d..d0dfd1ab92 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/EolRepositoryTest.java
@@ -142,8 +142,6 @@ public class EolRepositoryTest extends RepositoryTestCase {
protected String CONTENT_MIXED;
- private TreeWalk walk;
-
/** work tree root .gitattributes */
private File dotGitattributes;
@@ -689,27 +687,25 @@ public class EolRepositoryTest extends RepositoryTestCase {
private void collectRepositoryState() throws Exception {
dirCache = db.readDirCache();
- walk = beginWalk();
- if (dotGitattributes != null)
- collectEntryContentAndAttributes(F, ".gitattributes", null);
- collectEntryContentAndAttributes(F, fileCRLF.getName(), entryCRLF);
- collectEntryContentAndAttributes(F, fileLF.getName(), entryLF);
- collectEntryContentAndAttributes(F, fileMixed.getName(), entryMixed);
- endWalk();
- }
-
- private TreeWalk beginWalk() throws Exception {
- TreeWalk newWalk = new TreeWalk(db);
- newWalk.addTree(new FileTreeIterator(db));
- newWalk.addTree(new DirCacheIterator(db.readDirCache()));
- return newWalk;
- }
-
- private void endWalk() throws IOException {
- assertFalse("Not all files tested", walk.next());
+ try (TreeWalk walk = new TreeWalk(db)) {
+ walk.addTree(new FileTreeIterator(db));
+ walk.addTree(new DirCacheIterator(db.readDirCache()));
+ if (dotGitattributes != null) {
+ collectEntryContentAndAttributes(walk, F, ".gitattributes",
+ null);
+ }
+ collectEntryContentAndAttributes(walk, F, fileCRLF.getName(),
+ entryCRLF);
+ collectEntryContentAndAttributes(walk, F, fileLF.getName(),
+ entryLF);
+ collectEntryContentAndAttributes(walk, F, fileMixed.getName(),
+ entryMixed);
+ assertFalse("Not all files tested", walk.next());
+ }
}
- private void collectEntryContentAndAttributes(FileMode type, String pathName,
+ private void collectEntryContentAndAttributes(TreeWalk walk, FileMode type,
+ String pathName,
ActualEntry e) throws IOException {
assertTrue("walk has entry", walk.next());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchAndPullCommandsRecurseSubmodulesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchAndPullCommandsRecurseSubmodulesTest.java
index 73a705b252..08ded559f5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchAndPullCommandsRecurseSubmodulesTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/FetchAndPullCommandsRecurseSubmodulesTest.java
@@ -343,19 +343,22 @@ public class FetchAndPullCommandsRecurseSubmodulesTest extends RepositoryTestCas
private void assertSubmoduleFetchHeads(ObjectId expectedHead1,
ObjectId expectedHead2) throws Exception {
+ Object newHead1 = null;
+ ObjectId newHead2 = null;
try (SubmoduleWalk walk = SubmoduleWalk
.forIndex(git2.getRepository())) {
assertTrue(walk.next());
- Repository r = walk.getRepository();
- ObjectId newHead1 = r.resolve(Constants.FETCH_HEAD);
- ObjectId newHead2;
- try (SubmoduleWalk walk2 = SubmoduleWalk.forIndex(r)) {
- assertTrue(walk2.next());
- newHead2 = walk2.getRepository().resolve(Constants.FETCH_HEAD);
+ try (Repository r = walk.getRepository()) {
+ newHead1 = r.resolve(Constants.FETCH_HEAD);
+ try (SubmoduleWalk walk2 = SubmoduleWalk.forIndex(r)) {
+ assertTrue(walk2.next());
+ try (Repository r2 = walk2.getRepository()) {
+ newHead2 = r2.resolve(Constants.FETCH_HEAD);
+ }
+ }
}
-
- assertEquals(expectedHead1, newHead1);
- assertEquals(expectedHead2, newHead2);
}
+ assertEquals(expectedHead1, newHead1);
+ assertEquals(expectedHead2, newHead2);
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
index 4401bcedb3..7c8ec23848 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
@@ -57,12 +57,9 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.RebaseCommand.InteractiveHandler;
@@ -78,6 +75,7 @@ import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.IllegalTodoFileModification;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.events.ChangeRecorder;
import org.eclipse.jgit.events.ListenerHandle;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
@@ -2014,10 +2012,9 @@ public class RebaseCommandTest extends RepositoryTestCase {
checkoutBranch("refs/heads/topic");
writeTrashFile("sub/file0", "unstaged modified file0");
- Set<String> modifiedFiles = new HashSet<>();
+ ChangeRecorder recorder = new ChangeRecorder();
ListenerHandle handle = db.getListenerList()
- .addWorkingTreeModifiedListener(
- event -> modifiedFiles.addAll(event.getModified()));
+ .addWorkingTreeModifiedListener(recorder);
try {
// rebase
assertEquals(Status.OK, git.rebase()
@@ -2035,9 +2032,8 @@ public class RebaseCommandTest extends RepositoryTestCase {
+ "[sub/file0, mode:100644, content:file0]",
indexState(CONTENT));
assertEquals(RepositoryState.SAFE, db.getRepositoryState());
- List<String> modified = new ArrayList<>(modifiedFiles);
- Collections.sort(modified);
- assertEquals("[file1, sub/file0]", modified.toString());
+ recorder.assertEvent(new String[] { "file1", "file2", "sub/file0" },
+ new String[0]);
}
@Test
@@ -2136,10 +2132,12 @@ public class RebaseCommandTest extends RepositoryTestCase {
private List<DiffEntry> getStashedDiff() throws AmbiguousObjectException,
IncorrectObjectTypeException, IOException, MissingObjectException {
ObjectId stashId = db.resolve("stash@{0}");
- RevWalk revWalk = new RevWalk(db);
- RevCommit stashCommit = revWalk.parseCommit(stashId);
- List<DiffEntry> diffs = diffWorkingAgainstHead(stashCommit, revWalk);
- return diffs;
+ try (RevWalk revWalk = new RevWalk(db)) {
+ RevCommit stashCommit = revWalk.parseCommit(stashId);
+ List<DiffEntry> diffs = diffWorkingAgainstHead(stashCommit,
+ revWalk);
+ return diffs;
+ }
}
private TreeWalk createTreeWalk() {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java
index 5868482c88..adc64d227e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java
@@ -69,83 +69,90 @@ public class AttributesHandlerTest extends RepositoryTestCase {
private static final FileMode F = FileMode.REGULAR_FILE;
- private TreeWalk walk;
-
@Test
public void testExpandNonMacro1() throws Exception {
setupRepo(null, null, null, "*.txt text");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("text"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("text"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandNonMacro2() throws Exception {
setupRepo(null, null, null, "*.txt -text");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("-text"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("-text"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandNonMacro3() throws Exception {
setupRepo(null, null, null, "*.txt !text");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs(""));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs(""));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandNonMacro4() throws Exception {
setupRepo(null, null, null, "*.txt text=auto");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("text=auto"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("text=auto"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandBuiltInMacro1() throws Exception {
setupRepo(null, null, null, "*.txt binary");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("binary -diff -merge -text"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt",
+ attrs("binary -diff -merge -text"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandBuiltInMacro2() throws Exception {
setupRepo(null, null, null, "*.txt -binary");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("-binary diff merge text"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt",
+ attrs("-binary diff merge text"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testExpandBuiltInMacro3() throws Exception {
setupRepo(null, null, null, "*.txt !binary");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs(""));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs(""));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -153,44 +160,48 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(
"[attr]foo a -b !c d=e", null, null, "*.txt foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo a -b d=e"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo a -b d=e"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testCustomGlobalMacro2() throws Exception {
setupRepo("[attr]foo a -b !c d=e", null, null, "*.txt -foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("-foo -a b d=e"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("-foo -a b d=e"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testCustomGlobalMacro3() throws Exception {
setupRepo("[attr]foo a -b !c d=e", null, null, "*.txt !foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs(""));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs(""));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testCustomGlobalMacro4() throws Exception {
setupRepo("[attr]foo a -b !c d=e", null, null, "*.txt foo=bar");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo=bar a -b d=bar"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo=bar a -b d=bar"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -198,11 +209,12 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo("[attr]foo bar1",
"[attr]foo bar2", null, "*.txt foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo bar2"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo bar2"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -211,12 +223,13 @@ public class AttributesHandlerTest extends RepositoryTestCase {
null,
"[attr]foo bar3", "*.txt foo");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo bar3"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo bar3"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -224,12 +237,13 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo("[attr]foo bar1",
"[attr]foo bar2", "[attr]foo bar3", "*.txt foo");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo bar2"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo bar2"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -238,11 +252,12 @@ public class AttributesHandlerTest extends RepositoryTestCase {
"[attr]foo x bar -foo",
null, null, "*.txt foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo x bar"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo x bar"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -250,11 +265,12 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(
"[attr]foo x -bar\n[attr]bar y -foo", null, null, "*.txt foo");
- walk = beginWalk();
- assertIteration(D, "sub");
- assertIteration(F, "sub/.gitattributes");
- assertIteration(F, "sub/a.txt", attrs("foo x -bar -y"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/.gitattributes");
+ assertIteration(walk, F, "sub/a.txt", attrs("foo x -bar -y"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -266,23 +282,30 @@ public class AttributesHandlerTest extends RepositoryTestCase {
// apply to any of the files here. It would match for a
// further subdirectory sub/sub. The sub/ rules must match
// only for directories.
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub", attrs("global"));
- assertIteration(F, "sub/.gitattributes", attrs("init top_sub"));
- assertIteration(F, "sub/a.txt", attrs("init foo top top_sub"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub", attrs("global"));
+ assertIteration(walk, F, "sub/.gitattributes",
+ attrs("init top_sub"));
+ assertIteration(walk, F, "sub/a.txt",
+ attrs("init foo top top_sub"));
+ assertFalse("Not all files tested", walk.next());
+ }
// All right, let's see that they *do* apply in sub/sub:
writeTrashFile("sub/sub/b.txt", "b");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub", attrs("global"));
- assertIteration(F, "sub/.gitattributes", attrs("init top_sub"));
- assertIteration(F, "sub/a.txt", attrs("init foo top top_sub"));
- assertIteration(D, "sub/sub", attrs("init subsub2 top_sub global"));
- assertIteration(F, "sub/sub/b.txt",
- attrs("init foo subsub top top_sub"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub", attrs("global"));
+ assertIteration(walk, F, "sub/.gitattributes",
+ attrs("init top_sub"));
+ assertIteration(walk, F, "sub/a.txt",
+ attrs("init foo top top_sub"));
+ assertIteration(walk, D, "sub/sub",
+ attrs("init subsub2 top_sub global"));
+ assertIteration(walk, F, "sub/sub/b.txt",
+ attrs("init foo subsub top top_sub"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -293,16 +316,17 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/b.jar", "bj");
writeTrashFile("sub/b.xml", "bx");
// On foo.xml/bar.jar we must not have 'xml'
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo.xml", attrs("xml"));
- assertIteration(F, "foo.xml/bar.jar", attrs("jar"));
- assertIteration(F, "foo.xml/bar.xml", attrs("xml"));
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(F, "sub/b.jar", attrs("jar"));
- assertIteration(F, "sub/b.xml", attrs("xml"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo.xml", attrs("xml"));
+ assertIteration(walk, F, "foo.xml/bar.jar", attrs("jar"));
+ assertIteration(walk, F, "foo.xml/bar.xml", attrs("xml"));
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, F, "sub/b.jar", attrs("jar"));
+ assertIteration(walk, F, "sub/b.xml", attrs("xml"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -314,18 +338,19 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/b.jar", "bj");
writeTrashFile("sub/b.xml", "bx");
writeTrashFile("sub/foo/b.jar", "bf");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo", attrs("xml"));
- assertIteration(F, "foo/bar.jar", attrs("jar"));
- assertIteration(F, "foo/bar.xml");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(F, "sub/b.jar", attrs("jar"));
- assertIteration(F, "sub/b.xml");
- assertIteration(D, "sub/foo", attrs("sub xml"));
- assertIteration(F, "sub/foo/b.jar", attrs("jar"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo", attrs("xml"));
+ assertIteration(walk, F, "foo/bar.jar", attrs("jar"));
+ assertIteration(walk, F, "foo/bar.xml");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, F, "sub/b.jar", attrs("jar"));
+ assertIteration(walk, F, "sub/b.xml");
+ assertIteration(walk, D, "sub/foo", attrs("sub xml"));
+ assertIteration(walk, F, "sub/foo/b.jar", attrs("jar"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -337,18 +362,19 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/b.xml", "bx");
writeTrashFile("sub/foo/b.jar", "bf");
// On foo.xml/bar.jar we must not have 'xml'
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(F, "foo/bar.jar", attrs("jar xml"));
- assertIteration(F, "foo/bar.xml", attrs("xml"));
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(F, "sub/b.jar", attrs("jar"));
- assertIteration(F, "sub/b.xml");
- assertIteration(D, "sub/foo");
- assertIteration(F, "sub/foo/b.jar", attrs("jar"));
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, F, "foo/bar.jar", attrs("jar xml"));
+ assertIteration(walk, F, "foo/bar.xml", attrs("xml"));
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, F, "sub/b.jar", attrs("jar"));
+ assertIteration(walk, F, "sub/b.xml");
+ assertIteration(walk, D, "sub/foo");
+ assertIteration(walk, F, "sub/foo/b.jar", attrs("jar"));
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -357,27 +383,29 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/a.txt", "1");
writeTrashFile("foo/sext", "2");
writeTrashFile("foo/s.txt", "3");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(F, "foo/s.txt", attrs("bar"));
- assertIteration(F, "foo/sext", attrs("bar"));
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, F, "foo/s.txt", attrs("bar"));
+ assertIteration(walk, F, "foo/sext", attrs("bar"));
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
public void testPrefixMatchNot() throws Exception {
setupRepo(null, null, "sub/new bar", null);
writeTrashFile("sub/new/foo.txt", "1");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -385,14 +413,15 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(null, null, "s[t-v]b/n[de]w bar", null);
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("sub/ndw", "2");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(F, "sub/ndw", attrs("bar"));
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, F, "sub/ndw", attrs("bar"));
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -400,15 +429,16 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(null, null, "sub/new/* bar", null);
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("sub/new/lower/foo.txt", "2");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new");
- assertIteration(F, "sub/new/foo.txt", attrs("bar"));
- assertIteration(D, "sub/new/lower", attrs("bar"));
- assertIteration(F, "sub/new/lower/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new");
+ assertIteration(walk, F, "sub/new/foo.txt", attrs("bar"));
+ assertIteration(walk, D, "sub/new/lower", attrs("bar"));
+ assertIteration(walk, F, "sub/new/lower/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -417,20 +447,21 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
writeTrashFile("sub/sub/new/foo.txt", "3");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new");
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- assertIteration(D, "sub/sub");
- assertIteration(D, "sub/sub/new");
- assertIteration(F, "sub/sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new");
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertIteration(walk, D, "sub/sub");
+ assertIteration(walk, D, "sub/sub/new");
+ assertIteration(walk, F, "sub/sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -438,17 +469,18 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(null, null, "**/sub/new/ bar", null);
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new", attrs("bar"));
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new", attrs("bar"));
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -457,20 +489,21 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
writeTrashFile("sub/sub/new/foo.txt", "3");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new", attrs("bar"));
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- assertIteration(D, "sub/sub");
- assertIteration(D, "sub/sub/new", attrs("bar"));
- assertIteration(F, "sub/sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new", attrs("bar"));
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertIteration(walk, D, "sub/sub");
+ assertIteration(walk, D, "sub/sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -479,20 +512,21 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
writeTrashFile("sub/sub/new/foo.txt", "3");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new", attrs("bar"));
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- assertIteration(D, "sub/sub");
- assertIteration(D, "sub/sub/new", attrs("bar"));
- assertIteration(F, "sub/sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new", attrs("bar"));
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertIteration(walk, D, "sub/sub");
+ assertIteration(walk, D, "sub/sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -500,17 +534,18 @@ public class AttributesHandlerTest extends RepositoryTestCase {
setupRepo(null, null, "s[uv]b/n*/ bar", null);
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new");
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new");
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -519,30 +554,32 @@ public class AttributesHandlerTest extends RepositoryTestCase {
writeTrashFile("sub/new/foo.txt", "1");
writeTrashFile("foo/sub/new/foo.txt", "2");
writeTrashFile("foo/new", "3");
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(D, "foo");
- assertIteration(F, "foo/new");
- assertIteration(D, "foo/sub");
- assertIteration(D, "foo/sub/new", attrs("bar"));
- assertIteration(F, "foo/sub/new/foo.txt");
- assertIteration(D, "sub");
- assertIteration(F, "sub/a.txt");
- assertIteration(D, "sub/new", attrs("bar"));
- assertIteration(F, "sub/new/foo.txt");
- endWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, D, "foo");
+ assertIteration(walk, F, "foo/new");
+ assertIteration(walk, D, "foo/sub");
+ assertIteration(walk, D, "foo/sub/new", attrs("bar"));
+ assertIteration(walk, F, "foo/sub/new/foo.txt");
+ assertIteration(walk, D, "sub");
+ assertIteration(walk, F, "sub/a.txt");
+ assertIteration(walk, D, "sub/new", attrs("bar"));
+ assertIteration(walk, F, "sub/new/foo.txt");
+ assertFalse("Not all files tested", walk.next());
+ }
}
private static Collection<Attribute> attrs(String s) {
return new AttributesRule("*", s).getAttributes();
}
- private void assertIteration(FileMode type, String pathName)
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName)
throws IOException {
- assertIteration(type, pathName, Collections.<Attribute> emptyList());
+ assertIteration(walk, type, pathName,
+ Collections.<Attribute> emptyList());
}
- private void assertIteration(FileMode type, String pathName,
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName,
Collection<Attribute> expectedAttrs) throws IOException {
assertTrue("walk has entry", walk.next());
assertEquals(pathName, walk.getPathString());
@@ -611,8 +648,4 @@ public class AttributesHandlerTest extends RepositoryTestCase {
newWalk.addTree(new FileTreeIterator(db));
return newWalk;
}
-
- private void endWalk() throws IOException {
- assertFalse("Not all files tested", walk.next());
- }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeDirCacheIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeDirCacheIteratorTest.java
index 837de74818..cb37d8978a 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeDirCacheIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeDirCacheIteratorTest.java
@@ -78,8 +78,6 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
private Git git;
- private TreeWalk walk;
-
@Override
@Before
public void setUp() throws Exception {
@@ -105,23 +103,25 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
// Adds file to index
git.add().addFilepattern(".").call();
- walk = beginWalk();
-
- assertIteration(F, ".gitattributes");
- assertIteration(F, "readme.txt", asList(EOL_LF));
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, F, "readme.txt", asList(EOL_LF));
- assertIteration(D, "src");
+ assertIteration(walk, D, "src");
- assertIteration(D, "src/config");
- assertIteration(F, "src/config/.gitattributes");
- assertIteration(F, "src/config/readme.txt", asList(DELTA_UNSET));
- assertIteration(F, "src/config/windows.file", null);
- assertIteration(F, "src/config/windows.txt", asList(DELTA_UNSET));
+ assertIteration(walk, D, "src/config");
+ assertIteration(walk, F, "src/config/.gitattributes");
+ assertIteration(walk, F, "src/config/readme.txt",
+ asList(DELTA_UNSET));
+ assertIteration(walk, F, "src/config/windows.file", null);
+ assertIteration(walk, F, "src/config/windows.txt",
+ asList(DELTA_UNSET));
- assertIteration(F, "windows.file", null);
- assertIteration(F, "windows.txt", asList(EOL_LF));
+ assertIteration(walk, F, "windows.file", null);
+ assertIteration(walk, F, "windows.txt", asList(EOL_LF));
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
/**
@@ -138,17 +138,18 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
// Adds file to index
git.add().addFilepattern(".").call();
- walk = beginWalk();
- assertIteration(F, "l0.txt");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, "l0.txt");
- assertIteration(D, "level1");
- assertIteration(F, "level1/l1.txt");
+ assertIteration(walk, D, "level1");
+ assertIteration(walk, F, "level1/l1.txt");
- assertIteration(D, "level1/level2");
- assertIteration(F, "level1/level2/l2.txt");
+ assertIteration(walk, D, "level1/level2");
+ assertIteration(walk, F, "level1/level2/l2.txt");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
/**
@@ -166,18 +167,19 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
// Adds file to index
git.add().addFilepattern(".").call();
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
- assertIteration(F, "l0.txt");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, F, "l0.txt");
- assertIteration(D, "level1");
- assertIteration(F, "level1/l1.txt");
+ assertIteration(walk, D, "level1");
+ assertIteration(walk, F, "level1/l1.txt");
- assertIteration(D, "level1/level2");
- assertIteration(F, "level1/level2/l2.txt");
+ assertIteration(walk, D, "level1/level2");
+ assertIteration(walk, F, "level1/level2/l2.txt");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -191,18 +193,19 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
// Adds file to index
git.add().addFilepattern(".").call();
- walk = beginWalk();
- assertIteration(F, ".gitattributes");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
- assertIteration(D, "levelA");
- assertIteration(F, "levelA/.gitattributes");
- assertIteration(F, "levelA/lA.txt");
+ assertIteration(walk, D, "levelA");
+ assertIteration(walk, F, "levelA/.gitattributes");
+ assertIteration(walk, F, "levelA/lA.txt");
- assertIteration(D, "levelB");
- assertIteration(F, "levelB/.gitattributes");
+ assertIteration(walk, D, "levelB");
+ assertIteration(walk, F, "levelB/.gitattributes");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -215,25 +218,27 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
// Adds file to index
git.add().addFilepattern(".").call();
- walk = beginWalk();
- assertIteration(F, "gitattributes");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, "gitattributes");
- assertIteration(F, "l0.txt");
+ assertIteration(walk, F, "l0.txt");
- assertIteration(D, "levelA");
- assertIteration(F, "levelA/file.gitattributes");
- assertIteration(F, "levelA/lA.txt");
+ assertIteration(walk, D, "levelA");
+ assertIteration(walk, F, "levelA/file.gitattributes");
+ assertIteration(walk, F, "levelA/lA.txt");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
- private void assertIteration(FileMode type, String pathName)
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName)
throws IOException {
- assertIteration(type, pathName, Collections.<Attribute> emptyList());
+ assertIteration(walk, type, pathName,
+ Collections.<Attribute> emptyList());
}
- private void assertIteration(FileMode type, String pathName,
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName,
List<Attribute> nodeAttrs) throws IOException {
assertTrue("walk has entry", walk.next());
assertEquals(pathName, walk.getPathString());
@@ -243,14 +248,14 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
AttributesNode attributesNode = itr.getEntryAttributesNode(db
.newObjectReader());
- assertAttributesNode(pathName, attributesNode, nodeAttrs);
+ assertAttributesNode(walk, pathName, attributesNode, nodeAttrs);
if (D.equals(type))
walk.enterSubtree();
}
- private void assertAttributesNode(String pathName,
+ private void assertAttributesNode(TreeWalk walk, String pathName,
AttributesNode attributesNode, List<Attribute> nodeAttrs)
throws IOException {
if (attributesNode == null)
@@ -292,8 +297,4 @@ public class AttributesNodeDirCacheIteratorTest extends RepositoryTestCase {
newWalk.addTree(new DirCacheIterator(db.readDirCache()));
return newWalk;
}
-
- private void endWalk() throws IOException {
- assertFalse("Not all files tested", walk.next());
- }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeWorkingTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeWorkingTreeIteratorTest.java
index b159cca0d5..9991ae59b0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeWorkingTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesNodeWorkingTreeIteratorTest.java
@@ -77,8 +77,6 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
private static Attribute DELTA_UNSET = new Attribute("delta", State.UNSET);
- private TreeWalk walk;
-
@Test
public void testRules() throws Exception {
@@ -102,24 +100,26 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
writeTrashFile("src/config/windows.file", "");
writeTrashFile("src/config/windows.txt", "");
- walk = beginWalk();
-
- assertIteration(F, ".gitattributes");
- assertIteration(F, "global.txt", asList(EOL_LF));
- assertIteration(F, "readme.txt", asList(EOL_LF));
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, F, "global.txt", asList(EOL_LF));
+ assertIteration(walk, F, "readme.txt", asList(EOL_LF));
- assertIteration(D, "src");
+ assertIteration(walk, D, "src");
- assertIteration(D, "src/config");
- assertIteration(F, "src/config/.gitattributes");
- assertIteration(F, "src/config/readme.txt", asList(DELTA_UNSET));
- assertIteration(F, "src/config/windows.file", null);
- assertIteration(F, "src/config/windows.txt", asList(DELTA_UNSET));
+ assertIteration(walk, D, "src/config");
+ assertIteration(walk, F, "src/config/.gitattributes");
+ assertIteration(walk, F, "src/config/readme.txt",
+ asList(DELTA_UNSET));
+ assertIteration(walk, F, "src/config/windows.file", null);
+ assertIteration(walk, F, "src/config/windows.txt",
+ asList(DELTA_UNSET));
- assertIteration(F, "windows.file", null);
- assertIteration(F, "windows.txt", asList(EOL_LF));
+ assertIteration(walk, F, "windows.file", null);
+ assertIteration(walk, F, "windows.txt", asList(EOL_LF));
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
/**
@@ -134,17 +134,17 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
writeTrashFile("level1/l1.txt", "");
writeTrashFile("level1/level2/l2.txt", "");
- walk = beginWalk();
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, "l0.txt");
- assertIteration(F, "l0.txt");
+ assertIteration(walk, D, "level1");
+ assertIteration(walk, F, "level1/l1.txt");
- assertIteration(D, "level1");
- assertIteration(F, "level1/l1.txt");
+ assertIteration(walk, D, "level1/level2");
+ assertIteration(walk, F, "level1/level2/l2.txt");
- assertIteration(D, "level1/level2");
- assertIteration(F, "level1/level2/l2.txt");
-
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
/**
@@ -160,18 +160,18 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
writeTrashFile("level1/l1.txt", "");
writeTrashFile("level1/level2/l2.txt", "");
- walk = beginWalk();
-
- assertIteration(F, ".gitattributes");
- assertIteration(F, "l0.txt");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
+ assertIteration(walk, F, "l0.txt");
- assertIteration(D, "level1");
- assertIteration(F, "level1/l1.txt");
+ assertIteration(walk, D, "level1");
+ assertIteration(walk, F, "level1/l1.txt");
- assertIteration(D, "level1/level2");
- assertIteration(F, "level1/level2/l2.txt");
+ assertIteration(walk, D, "level1/level2");
+ assertIteration(walk, F, "level1/level2/l2.txt");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
@Test
@@ -183,26 +183,27 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
writeTrashFile("levelA/lA.txt", "");
- walk = beginWalk();
-
- assertIteration(F, ".gitattributes");
+ try (TreeWalk walk = beginWalk()) {
+ assertIteration(walk, F, ".gitattributes");
- assertIteration(D, "levelA");
- assertIteration(F, "levelA/.gitattributes");
- assertIteration(F, "levelA/lA.txt");
+ assertIteration(walk, D, "levelA");
+ assertIteration(walk, F, "levelA/.gitattributes");
+ assertIteration(walk, F, "levelA/lA.txt");
- assertIteration(D, "levelB");
- assertIteration(F, "levelB/.gitattributes");
+ assertIteration(walk, D, "levelB");
+ assertIteration(walk, F, "levelB/.gitattributes");
- endWalk();
+ assertFalse("Not all files tested", walk.next());
+ }
}
- private void assertIteration(FileMode type, String pathName)
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName)
throws IOException {
- assertIteration(type, pathName, Collections.<Attribute> emptyList());
+ assertIteration(walk, type, pathName,
+ Collections.<Attribute> emptyList());
}
- private void assertIteration(FileMode type, String pathName,
+ private void assertIteration(TreeWalk walk, FileMode type, String pathName,
List<Attribute> nodeAttrs)
throws IOException {
assertTrue("walk has entry", walk.next());
@@ -212,13 +213,13 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
assertNotNull("has tree", itr);
AttributesNode attributesNode = itr.getEntryAttributesNode();
- assertAttributesNode(pathName, attributesNode, nodeAttrs);
+ assertAttributesNode(walk, pathName, attributesNode, nodeAttrs);
if (D.equals(type))
walk.enterSubtree();
}
- private void assertAttributesNode(String pathName,
+ private void assertAttributesNode(TreeWalk walk, String pathName,
AttributesNode attributesNode, List<Attribute> nodeAttrs)
throws IOException {
if (attributesNode == null)
@@ -259,8 +260,4 @@ public class AttributesNodeWorkingTreeIteratorTest extends RepositoryTestCase {
newWalk.addTree(new FileTreeIterator(db));
return newWalk;
}
-
- private void endWalk() throws IOException {
- assertFalse("Not all files tested", walk.next());
- }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java
index d6aead4a52..0291fcc1e9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java
@@ -131,6 +131,12 @@ public class TreeWalkAttributeTest extends RepositoryTestCase {
@Override
@After
public void tearDown() throws Exception {
+ if (walk != null) {
+ walk.close();
+ }
+ if (ci_walk != null) {
+ ci_walk.close();
+ }
super.tearDown();
if (customAttributeFile != null)
customAttributeFile.delete();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
index cbc0761463..45046a3999 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreNodeTest.java
@@ -63,6 +63,7 @@ import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.treewalk.WorkingTreeIterator;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
+import org.junit.After;
import org.junit.Test;
/**
@@ -79,6 +80,13 @@ public class IgnoreNodeTest extends RepositoryTestCase {
private TreeWalk walk;
+ @After
+ public void closeWalk() {
+ if (walk != null) {
+ walk.close();
+ }
+ }
+
@Test
public void testSimpleRootGitIgnoreGlobalIgnore() throws IOException {
writeIgnoreFile(".gitignore", "x");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
index 5a5ae1d7a3..cfc275a7de 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollectorTest.java
@@ -723,7 +723,7 @@ public class DfsGarbageCollectorTest {
DfsPackDescription t1 = odb.newPack(INSERT);
try (DfsOutputStream out = odb.writeFile(t1, REFTABLE)) {
- new ReftableWriter().begin(out).finish();
+ new ReftableWriter(out).begin().finish();
t1.addFileExt(REFTABLE);
}
odb.commitPack(Collections.singleton(t1), null);
@@ -755,7 +755,7 @@ public class DfsGarbageCollectorTest {
DfsPackDescription t1 = odb.newPack(INSERT);
try (DfsOutputStream out = odb.writeFile(t1, REFTABLE)) {
- new ReftableWriter().begin(out).finish();
+ new ReftableWriter(out).begin().finish();
t1.addFileExt(REFTABLE);
}
odb.commitPack(Collections.singleton(t1), null);
@@ -795,10 +795,10 @@ public class DfsGarbageCollectorTest {
Ref next = new ObjectIdRef.PeeledNonTag(Ref.Storage.LOOSE,
"refs/heads/next", commit0.copy());
try (DfsOutputStream out = odb.writeFile(t1, REFTABLE)) {
- ReftableWriter w = new ReftableWriter();
+ ReftableWriter w = new ReftableWriter(out);
w.setMinUpdateIndex(42);
w.setMaxUpdateIndex(42);
- w.begin(out);
+ w.begin();
w.sortAndWriteRefs(Collections.singleton(next));
w.finish();
t1.addFileExt(REFTABLE);
@@ -877,10 +877,10 @@ public class DfsGarbageCollectorTest {
Ref newNext = new ObjectIdRef.PeeledNonTag(Ref.Storage.LOOSE, NEXT,
commit1);
try (DfsOutputStream out = odb.writeFile(t1, REFTABLE)) {
- ReftableWriter w = new ReftableWriter();
- w.setMinUpdateIndex(1);
- w.setMaxUpdateIndex(1);
- w.begin(out);
+ ReftableWriter w = new ReftableWriter(out)
+ .setMinUpdateIndex(1)
+ .setMaxUpdateIndex(1)
+ .begin();
w.writeRef(newNext, 1);
w.finish();
t1.addFileExt(REFTABLE);
@@ -929,10 +929,10 @@ public class DfsGarbageCollectorTest {
Ref newNext = new ObjectIdRef.PeeledNonTag(Ref.Storage.LOOSE, NEXT,
commit1);
try (DfsOutputStream out = odb.writeFile(t1, REFTABLE)) {
- ReftableWriter w = new ReftableWriter();
- w.setMinUpdateIndex(1);
- w.setMaxUpdateIndex(1);
- w.begin(out);
+ ReftableWriter w = new ReftableWriter(out)
+ .setMinUpdateIndex(1)
+ .setMaxUpdateIndex(1)
+ .begin();
w.writeRef(newNext, 1);
w.finish();
t1.addFileExt(REFTABLE);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java
index e71ee6d25f..4d36144212 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java
@@ -92,18 +92,22 @@ public class DfsInserterTest {
@Test
public void testReadFromInserterSmallObjects() throws IOException {
- ObjectInserter ins = db.newObjectInserter();
- ObjectId id1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ObjectId id2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("bar"));
- assertEquals(0, db.getObjectDatabase().listPacks().size());
+ try (ObjectInserter ins = db.newObjectInserter()) {
+ ObjectId id1 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("foo"));
+ ObjectId id2 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("bar"));
+ assertEquals(0, db.getObjectDatabase().listPacks().size());
- ObjectReader reader = ins.newReader();
- assertSame(ins, reader.getCreatedFromInserter());
- assertEquals("foo", readString(reader.open(id1)));
- assertEquals("bar", readString(reader.open(id2)));
- assertEquals(0, db.getObjectDatabase().listPacks().size());
- ins.flush();
- assertEquals(1, db.getObjectDatabase().listPacks().size());
+ try (ObjectReader reader = ins.newReader()) {
+ assertSame(ins, reader.getCreatedFromInserter());
+ assertEquals("foo", readString(reader.open(id1)));
+ assertEquals("bar", readString(reader.open(id2)));
+ assertEquals(0, db.getObjectDatabase().listPacks().size());
+ ins.flush();
+ assertEquals(1, db.getObjectDatabase().listPacks().size());
+ }
+ }
}
@Test
@@ -114,17 +118,19 @@ public class DfsInserterTest {
.setBlockLimit(2048));
byte[] data = new TestRng(JGitTestUtil.getName()).nextBytes(8192);
- DfsInserter ins = (DfsInserter) db.newObjectInserter();
- ins.setCompressionLevel(Deflater.NO_COMPRESSION);
- ObjectId id1 = ins.insert(Constants.OBJ_BLOB, data);
- assertEquals(0, db.getObjectDatabase().listPacks().size());
+ try (DfsInserter ins = (DfsInserter) db.newObjectInserter()) {
+ ins.setCompressionLevel(Deflater.NO_COMPRESSION);
+ ObjectId id1 = ins.insert(Constants.OBJ_BLOB, data);
+ assertEquals(0, db.getObjectDatabase().listPacks().size());
- ObjectReader reader = ins.newReader();
- assertSame(ins, reader.getCreatedFromInserter());
- assertTrue(Arrays.equals(data, readStream(reader.open(id1))));
- assertEquals(0, db.getObjectDatabase().listPacks().size());
- ins.flush();
+ try (ObjectReader reader = ins.newReader()) {
+ assertSame(ins, reader.getCreatedFromInserter());
+ assertTrue(Arrays.equals(data, readStream(reader.open(id1))));
+ assertEquals(0, db.getObjectDatabase().listPacks().size());
+ }
+ ins.flush();
+ }
List<DfsPackDescription> packs = db.getObjectDatabase().listPacks();
assertEquals(1, packs.size());
assertTrue(packs.get(0).getFileSize(PackExt.PACK) > 2048);
@@ -132,48 +138,58 @@ public class DfsInserterTest {
@Test
public void testReadFromFallback() throws IOException {
- ObjectInserter ins = db.newObjectInserter();
- ObjectId id1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ins.flush();
- ObjectId id2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("bar"));
- assertEquals(1, db.getObjectDatabase().listPacks().size());
-
- ObjectReader reader = ins.newReader();
- assertSame(ins, reader.getCreatedFromInserter());
- assertEquals("foo", readString(reader.open(id1)));
- assertEquals("bar", readString(reader.open(id2)));
- assertEquals(1, db.getObjectDatabase().listPacks().size());
- ins.flush();
- assertEquals(2, db.getObjectDatabase().listPacks().size());
+ try (ObjectInserter ins = db.newObjectInserter()) {
+ ObjectId id1 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("foo"));
+ ins.flush();
+ ObjectId id2 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("bar"));
+ assertEquals(1, db.getObjectDatabase().listPacks().size());
+
+ try (ObjectReader reader = ins.newReader()) {
+ assertSame(ins, reader.getCreatedFromInserter());
+ assertEquals("foo", readString(reader.open(id1)));
+ assertEquals("bar", readString(reader.open(id2)));
+ assertEquals(1, db.getObjectDatabase().listPacks().size());
+ }
+ ins.flush();
+ assertEquals(2, db.getObjectDatabase().listPacks().size());
+ }
}
@Test
public void testReaderResolve() throws IOException {
- ObjectInserter ins = db.newObjectInserter();
- ObjectId id1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ins.flush();
- ObjectId id2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("bar"));
- String abbr1 = ObjectId.toString(id1).substring(0, 4);
- String abbr2 = ObjectId.toString(id2).substring(0, 4);
- assertFalse(abbr1.equals(abbr2));
-
- ObjectReader reader = ins.newReader();
- assertSame(ins, reader.getCreatedFromInserter());
- Collection<ObjectId> objs;
- objs = reader.resolve(AbbreviatedObjectId.fromString(abbr1));
- assertEquals(1, objs.size());
- assertEquals(id1, objs.iterator().next());
-
- objs = reader.resolve(AbbreviatedObjectId.fromString(abbr2));
- assertEquals(1, objs.size());
- assertEquals(id2, objs.iterator().next());
+ try (ObjectInserter ins = db.newObjectInserter()) {
+ ObjectId id1 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("foo"));
+ ins.flush();
+ ObjectId id2 = ins.insert(Constants.OBJ_BLOB,
+ Constants.encode("bar"));
+ String abbr1 = ObjectId.toString(id1).substring(0, 4);
+ String abbr2 = ObjectId.toString(id2).substring(0, 4);
+ assertFalse(abbr1.equals(abbr2));
+
+ try (ObjectReader reader = ins.newReader()) {
+ assertSame(ins, reader.getCreatedFromInserter());
+ Collection<ObjectId> objs;
+ objs = reader.resolve(AbbreviatedObjectId.fromString(abbr1));
+ assertEquals(1, objs.size());
+ assertEquals(id1, objs.iterator().next());
+
+ objs = reader.resolve(AbbreviatedObjectId.fromString(abbr2));
+ assertEquals(1, objs.size());
+ assertEquals(id2, objs.iterator().next());
+ }
+ }
}
@Test
public void testGarbageSelectivelyVisible() throws IOException {
- ObjectInserter ins = db.newObjectInserter();
- ObjectId fooId = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ins.flush();
+ ObjectId fooId;
+ try (ObjectInserter ins = db.newObjectInserter()) {
+ fooId = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
+ ins.flush();
+ }
assertEquals(1, db.getObjectDatabase().listPacks().size());
// Make pack 0 garbage.
@@ -187,36 +203,40 @@ public class DfsInserterTest {
@Test
public void testInserterIgnoresUnreachable() throws IOException {
- ObjectInserter ins = db.newObjectInserter();
- ObjectId fooId = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ins.flush();
- assertEquals(1, db.getObjectDatabase().listPacks().size());
+ ObjectId fooId;
+ try (ObjectInserter ins = db.newObjectInserter()) {
+ fooId = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
+ ins.flush();
+ assertEquals(1, db.getObjectDatabase().listPacks().size());
- // Make pack 0 garbage.
- db.getObjectDatabase().listPacks().get(0).setPackSource(PackSource.UNREACHABLE_GARBAGE);
+ // Make pack 0 garbage.
+ db.getObjectDatabase().listPacks().get(0)
+ .setPackSource(PackSource.UNREACHABLE_GARBAGE);
- // We shouldn't be able to see foo because it's garbage.
- assertFalse(db.getObjectDatabase().has(fooId, true));
+ // We shouldn't be able to see foo because it's garbage.
+ assertFalse(db.getObjectDatabase().has(fooId, true));
- // But if we re-insert foo, it should become visible again.
- ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
- ins.flush();
+ // But if we re-insert foo, it should become visible again.
+ ins.insert(Constants.OBJ_BLOB, Constants.encode("foo"));
+ ins.flush();
+ }
assertTrue(db.getObjectDatabase().has(fooId, true));
// Verify that we have a foo in both packs, and 1 of them is garbage.
- DfsReader reader = new DfsReader(db.getObjectDatabase());
- DfsPackFile packs[] = db.getObjectDatabase().getPacks();
- Set<PackSource> pack_sources = new HashSet<>();
+ try (DfsReader reader = new DfsReader(db.getObjectDatabase())) {
+ DfsPackFile packs[] = db.getObjectDatabase().getPacks();
+ Set<PackSource> pack_sources = new HashSet<>();
- assertEquals(2, packs.length);
+ assertEquals(2, packs.length);
- pack_sources.add(packs[0].getPackDescription().getPackSource());
- pack_sources.add(packs[1].getPackDescription().getPackSource());
+ pack_sources.add(packs[0].getPackDescription().getPackSource());
+ pack_sources.add(packs[1].getPackDescription().getPackSource());
- assertTrue(packs[0].hasObject(reader, fooId));
- assertTrue(packs[1].hasObject(reader, fooId));
- assertTrue(pack_sources.contains(PackSource.UNREACHABLE_GARBAGE));
- assertTrue(pack_sources.contains(PackSource.INSERT));
+ assertTrue(packs[0].hasObject(reader, fooId));
+ assertTrue(packs[1].hasObject(reader, fooId));
+ assertTrue(pack_sources.contains(PackSource.UNREACHABLE_GARBAGE));
+ assertTrue(pack_sources.contains(PackSource.INSERT));
+ }
}
@Test
@@ -237,17 +257,20 @@ public class DfsInserterTest {
assertEquals(2, db.getObjectDatabase().listPacks().size());
// Verify that we have a foo in both INSERT packs.
- DfsReader reader = new DfsReader(db.getObjectDatabase());
- DfsPackFile packs[] = db.getObjectDatabase().getPacks();
-
- assertEquals(2, packs.length);
- DfsPackFile p1 = packs[0];
- assertEquals(PackSource.INSERT, p1.getPackDescription().getPackSource());
- assertTrue(p1.hasObject(reader, fooId));
-
- DfsPackFile p2 = packs[1];
- assertEquals(PackSource.INSERT, p2.getPackDescription().getPackSource());
- assertTrue(p2.hasObject(reader, fooId));
+ try (DfsReader reader = new DfsReader(db.getObjectDatabase())) {
+ DfsPackFile packs[] = db.getObjectDatabase().getPacks();
+
+ assertEquals(2, packs.length);
+ DfsPackFile p1 = packs[0];
+ assertEquals(PackSource.INSERT,
+ p1.getPackDescription().getPackSource());
+ assertTrue(p1.hasObject(reader, fooId));
+
+ DfsPackFile p2 = packs[1];
+ assertEquals(PackSource.INSERT,
+ p2.getPackDescription().getPackSource());
+ assertTrue(p2.hasObject(reader, fooId));
+ }
}
private static String readString(ObjectLoader loader) throws IOException {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileSnapshotTest.java
index d5bc61a692..9016a02b0b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileSnapshotTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileSnapshotTest.java
@@ -295,9 +295,8 @@ public class PackFileSnapshotTest extends RepositoryTestCase {
Files.copy(src, dstOut);
return dst;
}
- } else {
- return Files.copy(src, dst, StandardCopyOption.REPLACE_EXISTING);
}
+ return Files.copy(src, dst, StandardCopyOption.REPLACE_EXISTING);
}
private Path copyPack(Path base, String srcSuffix, String dstSuffix)
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
index 1e2341b6a5..3f281c49d2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
@@ -468,22 +468,22 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
@Test
public void testDeltaStatistics() throws Exception {
config.setDeltaCompress(true);
+ // TestRepository will close repo
FileRepository repo = createBareRepository();
ArrayList<RevObject> blobs = new ArrayList<>();
try (TestRepository<FileRepository> testRepo = new TestRepository<>(
repo)) {
blobs.add(testRepo.blob(genDeltableData(1000)));
blobs.add(testRepo.blob(genDeltableData(1005)));
- }
-
- try (PackWriter pw = new PackWriter(repo)) {
- NullProgressMonitor m = NullProgressMonitor.INSTANCE;
- pw.preparePack(blobs.iterator());
- pw.writePack(m, m, os);
- PackStatistics stats = pw.getStatistics();
- assertEquals(1, stats.getTotalDeltas());
- assertTrue("Delta bytes not set.",
- stats.byObjectType(OBJ_BLOB).getDeltaBytes() > 0);
+ try (PackWriter pw = new PackWriter(repo)) {
+ NullProgressMonitor m = NullProgressMonitor.INSTANCE;
+ pw.preparePack(blobs.iterator());
+ pw.writePack(m, m, os);
+ PackStatistics stats = pw.getStatistics();
+ assertEquals(1, stats.getTotalDeltas());
+ assertTrue("Delta bytes not set.",
+ stats.byObjectType(OBJ_BLOB).getDeltaBytes() > 0);
+ }
}
}
@@ -535,6 +535,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
@Test
public void testExclude() throws Exception {
+ // TestRepository closes repo
FileRepository repo = createBareRepository();
try (TestRepository<FileRepository> testRepo = new TestRepository<>(
@@ -568,98 +569,102 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
@Test
public void testShallowIsMinimalDepth1() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 1, wants(c2), NONE, NONE);
- assertContent(idx, Arrays.asList(c2.getId(), c2.getTree().getId(),
- contentA.getId(), contentB.getId()));
-
- // Client already has blobs A and B, verify those are not packed.
- idx = writeShallowPack(repo, 1, wants(c5), haves(c2), shallows(c2));
- assertContent(idx, Arrays.asList(c5.getId(), c5.getTree().getId(),
- contentC.getId(), contentD.getId(), contentE.getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 1, wants(c2), NONE, NONE);
+ assertContent(idx, Arrays.asList(c2.getId(), c2.getTree().getId(),
+ contentA.getId(), contentB.getId()));
+
+ // Client already has blobs A and B, verify those are not packed.
+ idx = writeShallowPack(repo, 1, wants(c5), haves(c2), shallows(c2));
+ assertContent(idx, Arrays.asList(c5.getId(), c5.getTree().getId(),
+ contentC.getId(), contentD.getId(), contentE.getId()));
+ }
}
@Test
public void testShallowIsMinimalDepth2() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 2, wants(c2), NONE, NONE);
- assertContent(idx,
- Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(),
- c2.getTree().getId(), contentA.getId(),
- contentB.getId()));
-
- // Client already has blobs A and B, verify those are not packed.
- idx = writeShallowPack(repo, 2, wants(c5), haves(c1, c2), shallows(c1));
- assertContent(idx,
- Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
- c5.getTree().getId(), contentC.getId(),
- contentD.getId(), contentE.getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 2, wants(c2), NONE, NONE);
+ assertContent(idx,
+ Arrays.asList(c1.getId(), c2.getId(), c1.getTree().getId(),
+ c2.getTree().getId(), contentA.getId(),
+ contentB.getId()));
+
+ // Client already has blobs A and B, verify those are not packed.
+ idx = writeShallowPack(repo, 2, wants(c5), haves(c1, c2),
+ shallows(c1));
+ assertContent(idx,
+ Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
+ c5.getTree().getId(), contentC.getId(),
+ contentD.getId(), contentE.getId()));
+ }
}
@Test
public void testShallowFetchShallowParentDepth1() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 1, wants(c5), NONE, NONE);
- assertContent(idx,
- Arrays.asList(c5.getId(), c5.getTree().getId(),
- contentA.getId(), contentB.getId(), contentC.getId(),
- contentD.getId(), contentE.getId()));
-
- idx = writeShallowPack(repo, 1, wants(c4), haves(c5), shallows(c5));
- assertContent(idx, Arrays.asList(c4.getId(), c4.getTree().getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 1, wants(c5), NONE, NONE);
+ assertContent(idx, Arrays.asList(c5.getId(), c5.getTree().getId(),
+ contentA.getId(), contentB.getId(), contentC.getId(),
+ contentD.getId(), contentE.getId()));
+
+ idx = writeShallowPack(repo, 1, wants(c4), haves(c5), shallows(c5));
+ assertContent(idx, Arrays.asList(c4.getId(), c4.getTree().getId()));
+ }
}
@Test
public void testShallowFetchShallowParentDepth2() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 2, wants(c5), NONE, NONE);
- assertContent(idx,
- Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
- c5.getTree().getId(), contentA.getId(),
- contentB.getId(), contentC.getId(), contentD.getId(),
- contentE.getId()));
-
- idx = writeShallowPack(repo, 2, wants(c3), haves(c4, c5), shallows(c4));
- assertContent(idx, Arrays.asList(c2.getId(), c3.getId(),
- c2.getTree().getId(), c3.getTree().getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 2, wants(c5), NONE, NONE);
+ assertContent(idx,
+ Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
+ c5.getTree().getId(), contentA.getId(),
+ contentB.getId(), contentC.getId(),
+ contentD.getId(), contentE.getId()));
+
+ idx = writeShallowPack(repo, 2, wants(c3), haves(c4, c5),
+ shallows(c4));
+ assertContent(idx, Arrays.asList(c2.getId(), c3.getId(),
+ c2.getTree().getId(), c3.getTree().getId()));
+ }
}
@Test
public void testShallowFetchShallowAncestorDepth1() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 1, wants(c5), NONE, NONE);
- assertContent(idx,
- Arrays.asList(c5.getId(), c5.getTree().getId(),
- contentA.getId(), contentB.getId(), contentC.getId(),
- contentD.getId(), contentE.getId()));
-
- idx = writeShallowPack(repo, 1, wants(c3), haves(c5), shallows(c5));
- assertContent(idx, Arrays.asList(c3.getId(), c3.getTree().getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 1, wants(c5), NONE, NONE);
+ assertContent(idx, Arrays.asList(c5.getId(), c5.getTree().getId(),
+ contentA.getId(), contentB.getId(), contentC.getId(),
+ contentD.getId(), contentE.getId()));
+
+ idx = writeShallowPack(repo, 1, wants(c3), haves(c5), shallows(c5));
+ assertContent(idx, Arrays.asList(c3.getId(), c3.getTree().getId()));
+ }
}
@Test
public void testShallowFetchShallowAncestorDepth2() throws Exception {
- FileRepository repo = setupRepoForShallowFetch();
-
- PackIndex idx = writeShallowPack(repo, 2, wants(c5), NONE, NONE);
- assertContent(idx,
- Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
- c5.getTree().getId(), contentA.getId(),
- contentB.getId(), contentC.getId(), contentD.getId(),
- contentE.getId()));
-
- idx = writeShallowPack(repo, 2, wants(c2), haves(c4, c5), shallows(c4));
- assertContent(idx, Arrays.asList(c1.getId(), c2.getId(),
- c1.getTree().getId(), c2.getTree().getId()));
+ try (FileRepository repo = setupRepoForShallowFetch()) {
+ PackIndex idx = writeShallowPack(repo, 2, wants(c5), NONE, NONE);
+ assertContent(idx,
+ Arrays.asList(c4.getId(), c5.getId(), c4.getTree().getId(),
+ c5.getTree().getId(), contentA.getId(),
+ contentB.getId(), contentC.getId(),
+ contentD.getId(), contentE.getId()));
+
+ idx = writeShallowPack(repo, 2, wants(c2), haves(c4, c5),
+ shallows(c4));
+ assertContent(idx, Arrays.asList(c1.getId(), c2.getId(),
+ c1.getTree().getId(), c2.getTree().getId()));
+ }
}
private FileRepository setupRepoForShallowFetch() throws Exception {
FileRepository repo = createBareRepository();
+ // TestRepository will close the repo, but we need to return an open
+ // one!
+ repo.incrementOpen();
try (TestRepository<Repository> r = new TestRepository<>(repo)) {
BranchBuilder bb = r.branch("refs/heads/master");
contentA = r.blob("A");
@@ -680,8 +685,9 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
private static PackIndex writePack(FileRepository repo,
Set<? extends ObjectId> want, Set<ObjectIdSet> excludeObjects)
throws IOException {
- RevWalk walk = new RevWalk(repo);
- return writePack(repo, walk, 0, want, NONE, excludeObjects);
+ try (RevWalk walk = new RevWalk(repo)) {
+ return writePack(repo, walk, 0, want, NONE, excludeObjects);
+ }
}
private static PackIndex writeShallowPack(FileRepository repo, int depth,
@@ -689,9 +695,10 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
Set<? extends ObjectId> shallow) throws IOException {
// During negotiation, UploadPack would have set up a DepthWalk and
// marked the client's "shallow" commits. Emulate that here.
- DepthWalk.RevWalk walk = new DepthWalk.RevWalk(repo, depth - 1);
- walk.assumeShallow(shallow);
- return writePack(repo, walk, depth, want, have, EMPTY_ID_SET);
+ try (DepthWalk.RevWalk walk = new DepthWalk.RevWalk(repo, depth - 1)) {
+ walk.assumeShallow(shallow);
+ return writePack(repo, walk, depth, want, have, EMPTY_ID_SET);
+ }
}
private static PackIndex writePack(FileRepository repo, RevWalk walk,
@@ -707,6 +714,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
if (depth > 0) {
pw.setShallowPack(depth, null);
}
+ // ow doesn't need to be closed; caller closes walk.
ObjectWalk ow = walk.toObjectWalkWithSameObjects();
pw.preparePack(NullProgressMonitor.INSTANCE, ow, want, have, NONE);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
index 43f30d8ca8..5100c1ce29 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/T0003_BasicTest.java
@@ -145,13 +145,14 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
}
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = (FileRepository) new FileRepositoryBuilder()
- .setGitDir(theDir).build();
- assertEqualsPath(theDir, r.getDirectory());
- assertEqualsPath(repo1Parent, r.getWorkTree());
- assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
- assertEqualsPath(new File(theDir, Constants.OBJECTS), r.getObjectDatabase()
- .getDirectory());
+ try (FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build()) {
+ assertEqualsPath(theDir, r.getDirectory());
+ assertEqualsPath(repo1Parent, r.getWorkTree());
+ assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
+ assertEqualsPath(new File(theDir, Constants.OBJECTS),
+ r.getObjectDatabase().getDirectory());
+ }
}
/**
@@ -170,14 +171,15 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
}
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ try (FileRepository r = (FileRepository) new FileRepositoryBuilder()
.setGitDir(theDir).setWorkTree(repo1Parent.getParentFile())
- .build();
- assertEqualsPath(theDir, r.getDirectory());
- assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree());
- assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
- assertEqualsPath(new File(theDir, Constants.OBJECTS), r.getObjectDatabase()
- .getDirectory());
+ .build()) {
+ assertEqualsPath(theDir, r.getDirectory());
+ assertEqualsPath(repo1Parent.getParentFile(), r.getWorkTree());
+ assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
+ assertEqualsPath(new File(theDir, Constants.OBJECTS),
+ r.getObjectDatabase().getDirectory());
+ }
}
/**
@@ -195,13 +197,14 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
}
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = (FileRepository) new FileRepositoryBuilder()
- .setWorkTree(repo1Parent).build();
- assertEqualsPath(theDir, r.getDirectory());
- assertEqualsPath(repo1Parent, r.getWorkTree());
- assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
- assertEqualsPath(new File(theDir, Constants.OBJECTS), r.getObjectDatabase()
- .getDirectory());
+ try (FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setWorkTree(repo1Parent).build()) {
+ assertEqualsPath(theDir, r.getDirectory());
+ assertEqualsPath(repo1Parent, r.getWorkTree());
+ assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
+ assertEqualsPath(new File(theDir, Constants.OBJECTS),
+ r.getObjectDatabase().getDirectory());
+ }
}
/**
@@ -224,13 +227,14 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
}
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = (FileRepository) new FileRepositoryBuilder()
- .setGitDir(theDir).build();
- assertEqualsPath(theDir, r.getDirectory());
- assertEqualsPath(workdir, r.getWorkTree());
- assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
- assertEqualsPath(new File(theDir, Constants.OBJECTS), r.getObjectDatabase()
- .getDirectory());
+ try (FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build()) {
+ assertEqualsPath(theDir, r.getDirectory());
+ assertEqualsPath(workdir, r.getWorkTree());
+ assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
+ assertEqualsPath(new File(theDir, Constants.OBJECTS),
+ r.getObjectDatabase().getDirectory());
+ }
}
/**
@@ -253,13 +257,14 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
}
File theDir = new File(repo1Parent, Constants.DOT_GIT);
- FileRepository r = (FileRepository) new FileRepositoryBuilder()
- .setGitDir(theDir).build();
- assertEqualsPath(theDir, r.getDirectory());
- assertEqualsPath(workdir, r.getWorkTree());
- assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
- assertEqualsPath(new File(theDir, Constants.OBJECTS), r.getObjectDatabase()
- .getDirectory());
+ try (FileRepository r = (FileRepository) new FileRepositoryBuilder()
+ .setGitDir(theDir).build()) {
+ assertEqualsPath(theDir, r.getDirectory());
+ assertEqualsPath(workdir, r.getWorkTree());
+ assertEqualsPath(new File(theDir, "index"), r.getIndexFile());
+ assertEqualsPath(new File(theDir, Constants.OBJECTS),
+ r.getObjectDatabase().getDirectory());
+ }
}
/**
@@ -306,17 +311,20 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
// open when we create it we won't write the object file out as a loose
// object (as it already exists in the pack).
//
- final Repository newdb = createBareRepository();
- try (ObjectInserter oi = newdb.newObjectInserter()) {
- final ObjectId treeId = oi.insert(new TreeFormatter());
- assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904",
- treeId.name());
+ try (Repository newdb = createBareRepository()) {
+ try (ObjectInserter oi = newdb.newObjectInserter()) {
+ final ObjectId treeId = oi.insert(new TreeFormatter());
+ assertEquals("4b825dc642cb6eb9a060e54bf8d69288fbee4904",
+ treeId.name());
+ }
+
+ final File o = new File(
+ new File(new File(newdb.getDirectory(), Constants.OBJECTS),
+ "4b"),
+ "825dc642cb6eb9a060e54bf8d69288fbee4904");
+ assertTrue("Exists " + o, o.isFile());
+ assertTrue("Read-only " + o, !o.canWrite());
}
-
- final File o = new File(new File(new File(newdb.getDirectory(),
- Constants.OBJECTS), "4b"), "825dc642cb6eb9a060e54bf8d69288fbee4904");
- assertTrue("Exists " + o, o.isFile());
- assertTrue("Read-only " + o, !o.canWrite());
}
@Test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
index 11d6439931..53d13f1d60 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/MergedReftableTest.java
@@ -187,6 +187,19 @@ public class MergedReftableTest {
}
}
+ @Test
+ public void tableByIDDeletion() throws IOException {
+ List<Ref> delta1 = Arrays.asList(
+ ref("refs/heads/apple", 1),
+ ref("refs/heads/master", 2));
+ List<Ref> delta2 = Arrays.asList(ref("refs/heads/master", 3));
+
+ MergedReftable mr = merge(write(delta1), write(delta2));
+ try (RefCursor rc = mr.byObjectId(id(2))) {
+ assertFalse(rc.next());
+ }
+ }
+
@SuppressWarnings("boxing")
@Test
public void fourTableScan() throws IOException {
@@ -225,29 +238,6 @@ public class MergedReftableTest {
}
@Test
- public void scanDuplicates() throws IOException {
- List<Ref> delta1 = Arrays.asList(
- ref("refs/heads/apple", 1),
- ref("refs/heads/banana", 2));
- List<Ref> delta2 = Arrays.asList(
- ref("refs/heads/apple", 3),
- ref("refs/heads/apple", 4));
-
- MergedReftable mr = merge(write(delta1, 1000), write(delta2, 2000));
- try (RefCursor rc = mr.allRefs()) {
- assertTrue(rc.next());
- assertEquals("refs/heads/apple", rc.getRef().getName());
- assertEquals(id(3), rc.getRef().getObjectId());
- assertEquals(2000, rc.getRef().getUpdateIndex());
- assertTrue(rc.next());
- assertEquals("refs/heads/banana", rc.getRef().getName());
- assertEquals(id(2), rc.getRef().getObjectId());
- assertEquals(1000, rc.getRef().getUpdateIndex());
- assertFalse(rc.next());
- }
- }
-
- @Test
public void scanIncludeDeletes() throws IOException {
List<Ref> delta1 = Arrays.asList(ref("refs/heads/next", 4));
List<Ref> delta2 = Arrays.asList(delete("refs/heads/next"));
@@ -297,10 +287,10 @@ public class MergedReftableTest {
@Test
public void missedUpdate() throws IOException {
ByteArrayOutputStream buf = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(buf)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(3)
- .begin(buf);
+ .begin();
writer.writeRef(ref("refs/heads/a", 1), 1);
writer.writeRef(ref("refs/heads/c", 3), 3);
writer.finish();
@@ -337,13 +327,13 @@ public class MergedReftableTest {
List<Ref> delta2 = Arrays.asList(delete("refs/heads/next"));
List<Ref> delta3 = Arrays.asList(ref("refs/heads/master", 8));
- ReftableCompactor compactor = new ReftableCompactor();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ReftableCompactor compactor = new ReftableCompactor(out);
compactor.addAll(Arrays.asList(
read(write(delta1)),
read(write(delta2)),
read(write(delta3))));
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- compactor.compact(out);
+ compactor.compact();
byte[] table = out.toByteArray();
ReftableReader reader = read(table);
@@ -414,7 +404,7 @@ public class MergedReftableTest {
}
private static MergedReftable merge(byte[]... table) {
- List<Reftable> stack = new ArrayList<>(table.length);
+ List<ReftableReader> stack = new ArrayList<>(table.length);
for (byte[] b : table) {
stack.add(read(b));
}
@@ -461,10 +451,10 @@ public class MergedReftableTest {
private byte[] write(Collection<Ref> refs, long updateIndex)
throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- new ReftableWriter()
+ new ReftableWriter(buffer)
.setMinUpdateIndex(updateIndex)
.setMaxUpdateIndex(updateIndex)
- .begin(buffer)
+ .begin()
.sortAndWriteRefs(refs)
.finish();
return buffer.toByteArray();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
index 1ea73097fe..9a7f240951 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableCompactorTest.java
@@ -67,9 +67,10 @@ public class ReftableCompactorTest {
@Test
public void noTables() throws IOException {
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
- compactor.compact(out);
+ compactor = new ReftableCompactor(out);
+ compactor.compact();
}
Stats stats = compactor.getStats();
assertEquals(0, stats.minUpdateIndex());
@@ -81,10 +82,10 @@ public class ReftableCompactorTest {
public void oneTable() throws IOException {
byte[] inTab;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(0)
.setMaxUpdateIndex(0)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 1));
writer.finish();
@@ -92,10 +93,11 @@ public class ReftableCompactorTest {
}
byte[] outTab;
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
+ compactor = new ReftableCompactor(outBuf);
compactor.tryAddFirst(read(inTab));
- compactor.compact(outBuf);
+ compactor.compact();
outTab = outBuf.toByteArray();
}
Stats stats = compactor.getStats();
@@ -116,10 +118,10 @@ public class ReftableCompactorTest {
public void twoTablesOneRef() throws IOException {
byte[] inTab1;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(0)
.setMaxUpdateIndex(0)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 1));
writer.finish();
@@ -128,10 +130,10 @@ public class ReftableCompactorTest {
byte[] inTab2;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 2));
writer.finish();
@@ -139,10 +141,11 @@ public class ReftableCompactorTest {
}
byte[] outTab;
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
+ compactor = new ReftableCompactor(outBuf);
compactor.addAll(Arrays.asList(read(inTab1), read(inTab2)));
- compactor.compact(outBuf);
+ compactor.compact();
outTab = outBuf.toByteArray();
}
Stats stats = compactor.getStats();
@@ -163,10 +166,10 @@ public class ReftableCompactorTest {
public void twoTablesTwoRefs() throws IOException {
byte[] inTab1;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(0)
.setMaxUpdateIndex(0)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 1));
writer.writeRef(ref(NEXT, 2));
@@ -176,10 +179,10 @@ public class ReftableCompactorTest {
byte[] inTab2;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 3));
writer.finish();
@@ -187,10 +190,11 @@ public class ReftableCompactorTest {
}
byte[] outTab;
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
+ compactor = new ReftableCompactor(outBuf);
compactor.addAll(Arrays.asList(read(inTab1), read(inTab2)));
- compactor.compact(outBuf);
+ compactor.compact();
outTab = outBuf.toByteArray();
}
Stats stats = compactor.getStats();
@@ -216,10 +220,10 @@ public class ReftableCompactorTest {
public void twoTablesIncludeOneDelete() throws IOException {
byte[] inTab1;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(0)
.setMaxUpdateIndex(0)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 1));
writer.finish();
@@ -228,10 +232,10 @@ public class ReftableCompactorTest {
byte[] inTab2;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(inBuf);
+ .begin();
writer.writeRef(tombstone(MASTER));
writer.finish();
@@ -239,11 +243,12 @@ public class ReftableCompactorTest {
}
byte[] outTab;
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
+ compactor = new ReftableCompactor(outBuf);
compactor.setIncludeDeletes(true);
compactor.addAll(Arrays.asList(read(inTab1), read(inTab2)));
- compactor.compact(outBuf);
+ compactor.compact();
outTab = outBuf.toByteArray();
}
Stats stats = compactor.getStats();
@@ -261,10 +266,10 @@ public class ReftableCompactorTest {
public void twoTablesNotIncludeOneDelete() throws IOException {
byte[] inTab1;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(0)
.setMaxUpdateIndex(0)
- .begin(inBuf);
+ .begin();
writer.writeRef(ref(MASTER, 1));
writer.finish();
@@ -273,10 +278,10 @@ public class ReftableCompactorTest {
byte[] inTab2;
try (ByteArrayOutputStream inBuf = new ByteArrayOutputStream()) {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(inBuf)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(inBuf);
+ .begin();
writer.writeRef(tombstone(MASTER));
writer.finish();
@@ -284,11 +289,12 @@ public class ReftableCompactorTest {
}
byte[] outTab;
- ReftableCompactor compactor = new ReftableCompactor();
+ ReftableCompactor compactor;
try (ByteArrayOutputStream outBuf = new ByteArrayOutputStream()) {
+ compactor = new ReftableCompactor(outBuf);
compactor.setIncludeDeletes(false);
compactor.addAll(Arrays.asList(read(inTab1), read(inTab2)));
- compactor.compact(outBuf);
+ compactor.compact();
outTab = outBuf.toByteArray();
}
Stats stats = compactor.getStats();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
index 0e33fa6e76..45e6c7d128 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftable/ReftableTest.java
@@ -66,6 +66,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.stream.Collectors;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.io.BlockSource;
@@ -76,6 +78,7 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.ReflogEntry;
import org.eclipse.jgit.lib.SymbolicRef;
+import org.hamcrest.Matchers;
import org.junit.Test;
public class ReftableTest {
@@ -134,9 +137,9 @@ public class ReftableTest {
byte[] table;
ReftableConfig cfg = new ReftableConfig();
cfg.setIndexObjects(false);
- ReftableWriter writer = new ReftableWriter().setConfig(cfg);
try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
- writer.begin(buf);
+ ReftableWriter writer = new ReftableWriter(buf).setConfig(cfg);
+ writer.begin();
assertEquals(92, writer.estimateTotalBytes());
writer.writeRef(exp);
assertEquals(expBytes, writer.estimateTotalBytes());
@@ -160,9 +163,9 @@ public class ReftableTest {
int expBytes = 147860;
byte[] table;
- ReftableWriter writer = new ReftableWriter().setConfig(cfg);
try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
- writer.begin(buf);
+ ReftableWriter writer = new ReftableWriter(buf).setConfig(cfg);
+ writer.begin();
writer.sortAndWriteRefs(refs);
assertEquals(expBytes, writer.estimateTotalBytes());
writer.finish();
@@ -418,27 +421,29 @@ public class ReftableTest {
}
@Test
- public void invalidRefWriteOrder() throws IOException {
+ public void invalidRefWriteOrderSortAndWrite() {
Ref master = ref(MASTER, 1);
- Ref next = ref(NEXT, 2);
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(new ByteArrayOutputStream())
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(new ByteArrayOutputStream());
+ .begin();
+
+ List<Ref> refs = new ArrayList<>();
+ refs.add(master);
+ refs.add(master);
- writer.writeRef(next);
IllegalArgumentException e = assertThrows(
IllegalArgumentException.class,
- () -> writer.writeRef(master));
+ () -> writer.sortAndWriteRefs(refs));
assertThat(e.getMessage(), containsString("records must be increasing"));
}
@Test
public void invalidReflogWriteOrderUpdateIndex() throws IOException {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(new ByteArrayOutputStream())
.setMinUpdateIndex(1)
.setMaxUpdateIndex(2)
- .begin(new ByteArrayOutputStream());
+ .begin();
PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
String msg = "test";
@@ -451,10 +456,10 @@ public class ReftableTest {
@Test
public void invalidReflogWriteOrderName() throws IOException {
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(new ByteArrayOutputStream())
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(new ByteArrayOutputStream());
+ .begin();
PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
String msg = "test";
@@ -473,10 +478,10 @@ public class ReftableTest {
String msg = "test";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(buffer)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(buffer);
+ .begin();
writer.writeRef(master);
writer.writeRef(next);
@@ -523,16 +528,95 @@ public class ReftableTest {
}
@Test
+ public void reflogReader() throws IOException {
+ Ref master = ref(MASTER, 1);
+ Ref next = ref(NEXT, 2);
+
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ReftableWriter writer = new ReftableWriter(buffer).setMinUpdateIndex(1)
+ .setMaxUpdateIndex(1).begin();
+
+ writer.writeRef(master);
+ writer.writeRef(next);
+
+ PersonIdent who1 = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
+ writer.writeLog(MASTER, 3, who1, ObjectId.zeroId(), id(1), "1");
+ PersonIdent who2 = new PersonIdent("Log", "Ger", 1500079710, -8 * 60);
+ writer.writeLog(MASTER, 2, who2, id(1), id(2), "2");
+ PersonIdent who3 = new PersonIdent("Log", "Ger", 1500079711, -8 * 60);
+ writer.writeLog(MASTER, 1, who3, id(2), id(3), "3");
+
+ writer.finish();
+ byte[] table = buffer.toByteArray();
+
+ ReentrantLock lock = new ReentrantLock();
+ ReftableReader t = read(table);
+ ReftableReflogReader rlr = new ReftableReflogReader(lock, t, MASTER);
+
+ assertEquals(rlr.getLastEntry().getWho(), who1);
+ List<PersonIdent> all = rlr.getReverseEntries().stream()
+ .map(x -> x.getWho()).collect(Collectors.toList());
+ Matchers.contains(all, who3, who2, who1);
+
+ assertEquals(rlr.getReverseEntry(1).getWho(), who2);
+
+ List<ReflogEntry> reverse2 = rlr.getReverseEntries(2);
+ Matchers.contains(reverse2, who3, who2);
+
+ List<PersonIdent> more = rlr.getReverseEntries(4).stream()
+ .map(x -> x.getWho()).collect(Collectors.toList());
+ assertEquals(all, more);
+ }
+
+ @Test
+ public void allRefs() throws IOException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ReftableConfig cfg = new ReftableConfig();
+ cfg.setRefBlockSize(1024);
+ cfg.setLogBlockSize(1024);
+ cfg.setAlignBlocks(true);
+ ReftableWriter writer = new ReftableWriter(buffer)
+ .setMinUpdateIndex(1)
+ .setMaxUpdateIndex(1)
+ .setConfig(cfg)
+ .begin();
+ PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
+
+ // Fill out the 1st ref block.
+ List<String> names = new ArrayList<>();
+ for (int i = 0; i < 4; i++) {
+ String name = new String(new char[220]).replace("\0", String.format("%c", i + 'a'));
+ names.add(name);
+ writer.writeRef(ref(name, i));
+ }
+
+ // Add some log data.
+ writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), "msg");
+ writer.finish();
+ byte[] table = buffer.toByteArray();
+
+ ReftableReader t = read(table);
+ RefCursor c = t.allRefs();
+
+ int j = 0;
+ while (c.next()) {
+ assertEquals(names.get(j), c.getRef().getName());
+ j++;
+ }
+ }
+
+
+ @Test
public void reflogSeek() throws IOException {
PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
String msg = "test";
String msgNext = "test next";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(buffer)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(buffer);
+ .begin();
writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg);
writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), msgNext);
@@ -572,10 +656,10 @@ public class ReftableTest {
PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(buffer)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(buffer);
+ .begin();
writer.writeLog("branchname", 1, who, ObjectId.zeroId(), id(1), "branchname");
@@ -596,10 +680,10 @@ public class ReftableTest {
String msg = "test";
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter()
+ ReftableWriter writer = new ReftableWriter(buffer)
.setMinUpdateIndex(1)
.setMaxUpdateIndex(1)
- .begin(buffer);
+ .begin();
writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg);
writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), msg);
writer.finish();
@@ -648,8 +732,8 @@ public class ReftableTest {
cfg.setLogBlockSize(2048);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter(cfg);
- writer.setMinUpdateIndex(1).setMaxUpdateIndex(1).begin(buffer);
+ ReftableWriter writer = new ReftableWriter(cfg, buffer);
+ writer.setMinUpdateIndex(1).setMaxUpdateIndex(1).begin();
List<Ref> refs = new ArrayList<>();
for (int i = 1; i <= 5670; i++) {
@@ -768,7 +852,7 @@ public class ReftableTest {
cfg.setRefBlockSize(64);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- ReftableWriter writer = new ReftableWriter(cfg).begin(buffer);
+ ReftableWriter writer = new ReftableWriter(cfg, buffer).begin();
writer.writeRef(ref("refs/heads/i-am-not-a-teapot", 1));
writer.finish();
fail("expected BlockSizeTooSmallException");
@@ -853,8 +937,8 @@ public class ReftableTest {
private byte[] write(Collection<Ref> refs) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- stats = new ReftableWriter()
- .begin(buffer)
+ stats = new ReftableWriter(buffer)
+ .begin()
.sortAndWriteRefs(refs)
.finish()
.getStats();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftree/RefTreeDatabaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftree/RefTreeDatabaseTest.java
index c3f5baa67b..50e0ed27c0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftree/RefTreeDatabaseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/reftree/RefTreeDatabaseTest.java
@@ -441,8 +441,9 @@ public class RefTreeDatabaseTest {
ReceiveCommand cmd = command(null, B, "refs/txn/tmp");
BatchRefUpdate batch = refdb.newBatchUpdate();
batch.addCommand(cmd);
- batch.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
-
+ try (RevWalk rw = new RevWalk(repo)) {
+ batch.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertEquals(REJECTED_OTHER_REASON, cmd.getResult());
assertEquals(MessageFormat.format(JGitText.get().invalidRefName,
"refs/txn/tmp"), cmd.getMessage());
@@ -461,8 +462,9 @@ public class RefTreeDatabaseTest {
ReceiveCommand cmd = command(null, B, "refs/heads/pu.lock");
BatchRefUpdate batch = refdb.newBatchUpdate();
batch.addCommand(cmd);
- batch.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
-
+ try (RevWalk rw = new RevWalk(repo)) {
+ batch.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertEquals(REJECTED_OTHER_REASON, cmd.getResult());
assertEquals(JGitText.get().funnyRefname, cmd.getMessage());
assertEquals(txnId, getTxnCommitted());
@@ -481,7 +483,9 @@ public class RefTreeDatabaseTest {
ReceiveCommand cmd = command(null, B, ORIG_HEAD);
BatchRefUpdate batch = refdb.newBatchUpdate();
batch.addCommand(cmd);
- batch.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
+ try (RevWalk rw = new RevWalk(repo)) {
+ batch.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertEquals(REJECTED_OTHER_REASON, cmd.getResult());
assertEquals(
MessageFormat.format(JGitText.get().invalidRefName, ORIG_HEAD),
@@ -500,7 +504,9 @@ public class RefTreeDatabaseTest {
command(B, A, "refs/heads/masters"));
BatchRefUpdate batchUpdate = refdb.newBatchUpdate();
batchUpdate.addCommand(commands);
- batchUpdate.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
+ try (RevWalk rw = new RevWalk(repo)) {
+ batchUpdate.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertEquals(txnId, getTxnCommitted());
assertEquals(REJECTED_NONFASTFORWARD,
@@ -523,7 +529,9 @@ public class RefTreeDatabaseTest {
BatchRefUpdate batchUpdate = refdb.newBatchUpdate();
batchUpdate.setAllowNonFastForwards(true);
batchUpdate.addCommand(commands);
- batchUpdate.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
+ try (RevWalk rw = new RevWalk(repo)) {
+ batchUpdate.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertNotEquals(txnId, getTxnCommitted());
Map<String, Ref> refs = refdb.getRefs(ALL);
@@ -547,13 +555,15 @@ public class RefTreeDatabaseTest {
BatchRefUpdate batchUpdate = refdb.newBatchUpdate();
batchUpdate.setAllowNonFastForwards(true);
batchUpdate.addCommand(commands);
- batchUpdate.execute(new RevWalk(repo) {
+ try (RevWalk rw = new RevWalk(repo) {
@Override
public boolean isMergedInto(RevCommit base, RevCommit tip) {
fail("isMergedInto() should not be called");
return false;
}
- }, NullProgressMonitor.INSTANCE);
+ }) {
+ batchUpdate.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertNotEquals(txnId, getTxnCommitted());
Map<String, Ref> refs = refdb.getRefs(ALL);
@@ -574,7 +584,9 @@ public class RefTreeDatabaseTest {
BatchRefUpdate batchUpdate = refdb.newBatchUpdate();
batchUpdate.setAllowNonFastForwards(true);
batchUpdate.addCommand(commands);
- batchUpdate.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
+ try (RevWalk rw = new RevWalk(repo)) {
+ batchUpdate.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertEquals(txnId, getTxnCommitted());
assertEquals(LOCK_FAILURE, commands.get(0).getResult());
@@ -601,7 +613,9 @@ public class RefTreeDatabaseTest {
BatchRefUpdate batchUpdate = refdb.newBatchUpdate();
batchUpdate.setAllowNonFastForwards(true);
batchUpdate.addCommand(commands);
- batchUpdate.execute(new RevWalk(repo), NullProgressMonitor.INSTANCE);
+ try (RevWalk rw = new RevWalk(repo)) {
+ batchUpdate.execute(rw, NullProgressMonitor.INSTANCE);
+ }
assertNotEquals(txnId, getTxnCommitted());
assertEquals(OK, commands.get(0).getResult());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
index 057e0c881b..46fd902b6c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java
@@ -341,48 +341,56 @@ public class DirCacheCheckoutMaliciousPathTest extends RepositoryTestCase {
String... path) throws GitAPIException, IOException {
try (Git git = new Git(db);
RevWalk revWalk = new RevWalk(git.getRepository())) {
- ObjectInserter newObjectInserter;
- newObjectInserter = git.getRepository().newObjectInserter();
- ObjectId blobId = newObjectInserter.insert(Constants.OBJ_BLOB,
+ ObjectId blobId;
+ try (ObjectInserter newObjectInserter = git.getRepository()
+ .newObjectInserter()) {
+ blobId = newObjectInserter.insert(Constants.OBJ_BLOB,
"data".getBytes(UTF_8));
- newObjectInserter = git.getRepository().newObjectInserter();
+ }
FileMode mode = FileMode.REGULAR_FILE;
ObjectId insertId = blobId;
- for (int i = path.length - 1; i >= 0; --i) {
- TreeFormatter treeFormatter = new TreeFormatter();
- treeFormatter.append("goodpath", mode, insertId);
- insertId = newObjectInserter.insert(treeFormatter);
- mode = FileMode.TREE;
+ try (ObjectInserter newObjectInserter = git.getRepository()
+ .newObjectInserter()) {
+ for (int i = path.length - 1; i >= 0; --i) {
+ TreeFormatter treeFormatter = new TreeFormatter();
+ treeFormatter.append("goodpath", mode, insertId);
+ insertId = newObjectInserter.insert(treeFormatter);
+ mode = FileMode.TREE;
+ }
}
- newObjectInserter = git.getRepository().newObjectInserter();
- CommitBuilder commitBuilder = new CommitBuilder();
- commitBuilder.setAuthor(author);
- commitBuilder.setCommitter(committer);
- commitBuilder.setMessage("foo#1");
- commitBuilder.setTreeId(insertId);
- ObjectId firstCommitId = newObjectInserter.insert(commitBuilder);
-
- newObjectInserter = git.getRepository().newObjectInserter();
- mode = FileMode.REGULAR_FILE;
- insertId = blobId;
- for (int i = path.length - 1; i >= 0; --i) {
- TreeFormatter treeFormatter = new TreeFormatter();
- treeFormatter.append(path[i].getBytes(UTF_8), 0,
- path[i].getBytes(UTF_8).length,
- mode, insertId, true);
- insertId = newObjectInserter.insert(treeFormatter);
- mode = FileMode.TREE;
+ ObjectId firstCommitId;
+ try (ObjectInserter newObjectInserter = git.getRepository()
+ .newObjectInserter()) {
+ CommitBuilder commitBuilder = new CommitBuilder();
+ commitBuilder.setAuthor(author);
+ commitBuilder.setCommitter(committer);
+ commitBuilder.setMessage("foo#1");
+ commitBuilder.setTreeId(insertId);
+ firstCommitId = newObjectInserter.insert(commitBuilder);
}
+ ObjectId commitId;
+ try (ObjectInserter newObjectInserter = git.getRepository()
+ .newObjectInserter()) {
+ mode = FileMode.REGULAR_FILE;
+ insertId = blobId;
+ for (int i = path.length - 1; i >= 0; --i) {
+ TreeFormatter treeFormatter = new TreeFormatter();
+ treeFormatter.append(path[i].getBytes(UTF_8), 0,
+ path[i].getBytes(UTF_8).length, mode, insertId,
+ true);
+ insertId = newObjectInserter.insert(treeFormatter);
+ mode = FileMode.TREE;
+ }
- // Create another commit
- commitBuilder = new CommitBuilder();
- commitBuilder.setAuthor(author);
- commitBuilder.setCommitter(committer);
- commitBuilder.setMessage("foo#2");
- commitBuilder.setTreeId(insertId);
- commitBuilder.setParentId(firstCommitId);
- ObjectId commitId = newObjectInserter.insert(commitBuilder);
-
+ // Create another commit
+ CommitBuilder commitBuilder = new CommitBuilder();
+ commitBuilder.setAuthor(author);
+ commitBuilder.setCommitter(committer);
+ commitBuilder.setMessage("foo#2");
+ commitBuilder.setTreeId(insertId);
+ commitBuilder.setParentId(firstCommitId);
+ commitId = newObjectInserter.insert(commitBuilder);
+ }
if (!secondCheckout)
git.checkout().setStartPoint(revWalk.parseCommit(firstCommitId))
.setName("refs/heads/master").setCreateBranch(true).call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
index 8092c3134b..a272c8f2ee 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java
@@ -349,9 +349,11 @@ public class DirCacheCheckoutTest extends RepositoryTestCase {
DirCacheEditor editor = dirCache.editor();
for (java.util.Map.Entry<String,String> e : indexEntries.entrySet()) {
writeTrashFile(e.getKey(), e.getValue());
- ObjectInserter inserter = db.newObjectInserter();
- final ObjectId id = inserter.insert(Constants.OBJ_BLOB,
+ ObjectId id;
+ try (ObjectInserter inserter = db.newObjectInserter()) {
+ id = inserter.insert(Constants.OBJ_BLOB,
Constants.encode(e.getValue()));
+ }
editor.add(new DirCacheEditor.DeletePath(e.getKey()));
editor.add(new DirCacheEditor.PathEdit(e.getKey()) {
@Override
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
index ba5aaf1b18..cf954070e0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
@@ -81,10 +81,12 @@ public class IndexDiffTest extends RepositoryTestCase {
static PathEdit add(final Repository db, final File workdir,
final String path) throws FileNotFoundException, IOException {
- ObjectInserter inserter = db.newObjectInserter();
final File f = new File(workdir, path);
- final ObjectId id = inserter.insert(Constants.OBJ_BLOB,
+ ObjectId id;
+ try (ObjectInserter inserter = db.newObjectInserter()) {
+ id = inserter.insert(Constants.OBJ_BLOB,
IO.readFully(f));
+ }
return new PathEdit(path) {
@Override
public void apply(DirCacheEntry ent) {
@@ -122,9 +124,11 @@ public class IndexDiffTest extends RepositoryTestCase {
public void testMissing() throws Exception {
File file2 = writeTrashFile("file2", "file2");
File file3 = writeTrashFile("dir/file3", "dir/file3");
- Git git = Git.wrap(db);
- git.add().addFilepattern("file2").addFilepattern("dir/file3").call();
- git.commit().setMessage("commit").call();
+ try (Git git = new Git(db)) {
+ git.add().addFilepattern("file2").addFilepattern("dir/file3")
+ .call();
+ git.commit().setMessage("commit").call();
+ }
assertTrue(file2.delete());
assertTrue(file3.delete());
IndexDiff diff = new IndexDiff(db, Constants.HEAD,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSerializerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSerializerTest.java
index d98b792d75..f0733f4782 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSerializerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSerializerTest.java
@@ -88,9 +88,8 @@ public class ObjectIdSerializerTest {
try (InputStream in = new FileInputStream(file)) {
if (objectId == null) {
return ObjectIdSerializer.read(in);
- } else {
- return ObjectIdSerializer.readWithoutMarker(in);
}
+ return ObjectIdSerializer.readWithoutMarker(in);
}
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java
index cbb47fa829..3f77ca25a3 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java
@@ -67,9 +67,8 @@ public class RefDatabaseConflictingNamesTest {
existing.put("refs/heads/a/b", null /* not used */);
existing.put("refs/heads/q", null /* not used */);
return existing;
- } else {
- return Collections.emptyMap();
}
+ return Collections.emptyMap();
}
@Override
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
index f2f277c6ea..9be71c3a02 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java
@@ -45,7 +45,7 @@
package org.eclipse.jgit.lib;
-import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -78,7 +78,10 @@ public class ReflogConfigTest extends RepositoryTestCase {
// set the logAllRefUpdates parameter to true and check it
cfg.setBoolean("core", null, "logallrefupdates", true);
cfg.save();
- assertTrue(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
+ assertEquals(CoreConfig.LogRefUpdates.TRUE,
+ cfg.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES,
+ CoreConfig.LogRefUpdates.FALSE));
// do one commit and check that reflog size is increased to 1
commit("A Commit\n", commitTime, tz);
@@ -90,13 +93,32 @@ public class ReflogConfigTest extends RepositoryTestCase {
// set the logAllRefUpdates parameter to false and check it
cfg.setBoolean("core", null, "logallrefupdates", false);
cfg.save();
- assertFalse(cfg.get(CoreConfig.KEY).isLogAllRefUpdates());
+ assertEquals(CoreConfig.LogRefUpdates.FALSE,
+ cfg.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES,
+ CoreConfig.LogRefUpdates.TRUE));
// do one commit and check that reflog size is 2
commit("A Commit\n", commitTime, tz);
+ commitTime += 60 * 1000;
assertTrue(
"Reflog for HEAD should contain two entries",
db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 2);
+
+ // set the logAllRefUpdates parameter to false and check it
+ cfg.setEnum("core", null, "logallrefupdates",
+ CoreConfig.LogRefUpdates.ALWAYS);
+ cfg.save();
+ assertEquals(CoreConfig.LogRefUpdates.ALWAYS,
+ cfg.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES,
+ CoreConfig.LogRefUpdates.FALSE));
+
+ // do one commit and check that reflog size is 3
+ commit("A Commit\n", commitTime, tz);
+ assertTrue("Reflog for HEAD should contain three entries",
+ db.getReflogReader(Constants.HEAD).getReverseEntries()
+ .size() == 3);
}
private void commit(String commitMsg, long commitTime, int tz)
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java
new file mode 100644
index 0000000000..220b2becba
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocatorTest.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2019, Thomas Wolf <thomas.wolf@paranor.ch>
+ * 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.lib.internal;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Locale;
+
+import org.junit.Test;
+
+public class BouncyCastleGpgKeyLocatorTest {
+
+ private static final String USER_ID = "Heinrich Heine <heinrichh@uni-duesseldorf.de>";
+
+ private static boolean match(String userId, String pattern) {
+ return BouncyCastleGpgKeyLocator.containsSigningKey(userId, pattern);
+ }
+
+ @Test
+ public void testFullMatch() throws Exception {
+ assertTrue(match(USER_ID,
+ "=Heinrich Heine <heinrichh@uni-duesseldorf.de>"));
+ assertFalse(match(USER_ID, "=Heinrich Heine"));
+ assertFalse(match(USER_ID, "= "));
+ assertFalse(match(USER_ID, "=heinrichh@uni-duesseldorf.de"));
+ }
+
+ @Test
+ public void testEmpty() throws Exception {
+ assertFalse(match(USER_ID, ""));
+ assertFalse(match(USER_ID, null));
+ assertFalse(match("", ""));
+ assertFalse(match(null, ""));
+ assertFalse(match(null, null));
+ assertFalse(match("", "something"));
+ assertFalse(match(null, "something"));
+ }
+
+ @Test
+ public void testFullEmail() throws Exception {
+ assertTrue(match(USER_ID, "<heinrichh@uni-duesseldorf.de>"));
+ assertTrue(match(USER_ID + " ", "<heinrichh@uni-duesseldorf.de>"));
+ assertFalse(match(USER_ID, "<>"));
+ assertFalse(match(USER_ID, "<h>"));
+ assertFalse(match(USER_ID, "<heinrichh>"));
+ assertFalse(match(USER_ID, "<uni-duesseldorf>"));
+ assertFalse(match(USER_ID, "<h@u>"));
+ assertFalse(match(USER_ID, "<HeinrichH@uni-duesseldorf.de>"));
+ assertFalse(match(USER_ID.substring(0, USER_ID.length() - 1),
+ "<heinrichh@uni-duesseldorf.de>"));
+ assertFalse(match("", "<>"));
+ assertFalse(match("", "<heinrichh@uni-duesseldorf.de>"));
+ }
+
+ @Test
+ public void testPartialEmail() throws Exception {
+ assertTrue(match(USER_ID, "@heinrichh@uni-duesseldorf.de"));
+ assertTrue(match(USER_ID, "@heinrichh"));
+ assertTrue(match(USER_ID, "@duesseldorf"));
+ assertTrue(match(USER_ID, "@uni-d"));
+ assertTrue(match(USER_ID, "@h"));
+ assertTrue(match(USER_ID, "@."));
+ assertTrue(match(USER_ID, "@h@u"));
+ assertFalse(match(USER_ID, "@ "));
+ assertFalse(match(USER_ID, "@"));
+ assertFalse(match(USER_ID, "@Heine"));
+ assertFalse(match(USER_ID, "@HeinrichH"));
+ assertFalse(match(USER_ID, "@Heinrich"));
+ assertFalse(match("", "@"));
+ assertFalse(match("", "@h"));
+ }
+
+ private void substringTests(String prefix) throws Exception {
+ assertTrue(match(USER_ID, prefix + "heinrichh@uni-duesseldorf.de"));
+ assertTrue(match(USER_ID, prefix + "heinrich"));
+ assertTrue(match(USER_ID, prefix + "HEIN"));
+ assertTrue(match(USER_ID, prefix + "Heine <"));
+ assertTrue(match(USER_ID, prefix + "UNI"));
+ assertTrue(match(USER_ID, prefix + "uni"));
+ assertTrue(match(USER_ID, prefix + "rich He"));
+ assertTrue(match(USER_ID, prefix + "h@u"));
+ assertTrue(match(USER_ID, prefix + USER_ID));
+ assertTrue(match(USER_ID, prefix + USER_ID.toUpperCase(Locale.ROOT)));
+ assertFalse(match(USER_ID, prefix + ""));
+ assertFalse(match(USER_ID, prefix + " "));
+ assertFalse(match(USER_ID, prefix + "yy"));
+ assertFalse(match("", prefix + ""));
+ assertFalse(match("", prefix + "uni"));
+ }
+
+ @Test
+ public void testSubstringPlain() throws Exception {
+ substringTests("");
+ }
+
+ @Test
+ public void testSubstringAsterisk() throws Exception {
+ substringTests("*");
+ }
+
+ @Test
+ public void testExplicitFingerprint() throws Exception {
+ assertFalse(match("John Fade <j.fade@example.com>", "0xfade"));
+ assertFalse(match("John Fade <0xfade@example.com>", "0xfade"));
+ assertFalse(match("", "0xfade"));
+ }
+
+ @Test
+ public void testImplicitFingerprint() throws Exception {
+ assertTrue(match("John Fade <j.fade@example.com>", "fade"));
+ assertTrue(match("John Fade <0xfade@example.com>", "fade"));
+ assertTrue(match("John Fade <j.fade@example.com>", "FADE"));
+ assertTrue(match("John Fade <0xfade@example.com>", "FADE"));
+ }
+
+ @Test
+ public void testZeroX() throws Exception {
+ assertTrue(match("John Fade <0xfade@example.com>", "0x"));
+ assertTrue(match("John Fade <0xfade@example.com>", "*0x"));
+ assertTrue(match("John Fade <0xfade@example.com>", "*0xfade"));
+ assertTrue(match("John Fade <0xfade@example.com>", "*0xFADE"));
+ assertTrue(match("John Fade <0xfade@example.com>", "@0xfade"));
+ assertFalse(match("John Fade <0xfade@example.com>", "@0xFADE"));
+ assertFalse(match("", "0x"));
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
index 19f6dcbc59..aa4392fcac 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java
@@ -106,23 +106,24 @@ public class CherryPickTest extends RepositoryTestCase {
boolean merge = twm.merge(new ObjectId[] { O, T });
assertTrue(merge);
- final TreeWalk tw = new TreeWalk(db);
- tw.setRecursive(true);
- tw.reset(twm.getResultTreeId());
+ try (TreeWalk tw = new TreeWalk(db)) {
+ tw.setRecursive(true);
+ tw.reset(twm.getResultTreeId());
- assertTrue(tw.next());
- assertEquals("a", tw.getPathString());
- assertCorrectId(treeO, tw);
+ assertTrue(tw.next());
+ assertEquals("a", tw.getPathString());
+ assertCorrectId(treeO, tw);
- assertTrue(tw.next());
- assertEquals("o", tw.getPathString());
- assertCorrectId(treeO, tw);
+ assertTrue(tw.next());
+ assertEquals("o", tw.getPathString());
+ assertCorrectId(treeO, tw);
- assertTrue(tw.next());
- assertEquals("t", tw.getPathString());
- assertCorrectId(treeT, tw);
+ assertTrue(tw.next());
+ assertEquals("t", tw.getPathString());
+ assertCorrectId(treeT, tw);
- assertFalse(tw.next());
+ assertFalse(tw.next());
+ }
}
@Test
@@ -168,19 +169,20 @@ public class CherryPickTest extends RepositoryTestCase {
boolean merge = twm.merge(new ObjectId[] { B, T });
assertTrue(merge);
- final TreeWalk tw = new TreeWalk(db);
- tw.setRecursive(true);
- tw.reset(twm.getResultTreeId());
+ try (TreeWalk tw = new TreeWalk(db)) {
+ tw.setRecursive(true);
+ tw.reset(twm.getResultTreeId());
- assertTrue(tw.next());
- assertEquals("a", tw.getPathString());
- assertCorrectId(treeB, tw);
+ assertTrue(tw.next());
+ assertEquals("a", tw.getPathString());
+ assertCorrectId(treeB, tw);
- assertTrue(tw.next());
- assertEquals("t", tw.getPathString());
- assertCorrectId(treeT, tw);
+ assertTrue(tw.next());
+ assertEquals("t", tw.getPathString());
+ assertCorrectId(treeT, tw);
- assertFalse(tw.next());
+ assertFalse(tw.next());
+ }
}
private static void assertCorrectId(DirCache treeT, TreeWalk tw) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CrissCrossMergeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CrissCrossMergeTest.java
index a67c750dba..5c6636c89e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CrissCrossMergeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CrissCrossMergeTest.java
@@ -881,9 +881,9 @@ public class CrissCrossMergeTest extends RepositoryTestCase {
}
StringBuilder result = new StringBuilder();
- ObjectReader or = r.newObjectReader();
- try (BufferedReader br = new BufferedReader(
- new InputStreamReader(or.open(blobId).openStream(), UTF_8))) {
+ try (ObjectReader or = r.newObjectReader();
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ or.open(blobId).openStream(), UTF_8))) {
String line;
boolean first = true;
while ((line = br.readLine()) != null) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
index 62495fb023..3379a25377 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
@@ -1365,8 +1365,8 @@ public class MergerTest extends RepositoryTestCase {
}
private String readBlob(ObjectId treeish, String path) throws Exception {
- try (TestRepository<?> tr = new TestRepository<>(db)) {
- RevWalk rw = tr.getRevWalk();
+ try (TestRepository<?> tr = new TestRepository<>(db);
+ RevWalk rw = tr.getRevWalk()) {
RevTree tree = rw.parseTree(treeish);
RevObject obj = tr.get(tree, path);
if (obj == null) {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
index dd2c2e84b6..6c0b165a4f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java
@@ -174,23 +174,24 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
boolean merge = ourMerger.merge(new ObjectId[] { o, t });
assertTrue(merge);
- final TreeWalk tw = new TreeWalk(db);
- tw.setRecursive(true);
- tw.reset(ourMerger.getResultTreeId());
+ try (TreeWalk tw = new TreeWalk(db)) {
+ tw.setRecursive(true);
+ tw.reset(ourMerger.getResultTreeId());
- assertTrue(tw.next());
- assertEquals("Makefile", tw.getPathString());
- assertCorrectId(treeO, tw);
+ assertTrue(tw.next());
+ assertEquals("Makefile", tw.getPathString());
+ assertCorrectId(treeO, tw);
- assertTrue(tw.next());
- assertEquals("libelf-po/a", tw.getPathString());
- assertCorrectId(treeO, tw);
+ assertTrue(tw.next());
+ assertEquals("libelf-po/a", tw.getPathString());
+ assertCorrectId(treeO, tw);
- assertTrue(tw.next());
- assertEquals("libelf/c", tw.getPathString());
- assertCorrectId(treeT, tw);
+ assertTrue(tw.next());
+ assertEquals("libelf/c", tw.getPathString());
+ assertCorrectId(treeT, tw);
- assertFalse(tw.next());
+ assertFalse(tw.next());
+ }
}
@Test
@@ -226,19 +227,20 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase {
boolean merge = ourMerger.merge(new ObjectId[] { o, t });
assertTrue(merge);
- final TreeWalk tw = new TreeWalk(db);
- tw.setRecursive(true);
- tw.reset(ourMerger.getResultTreeId());
+ try (TreeWalk tw = new TreeWalk(db)) {
+ tw.setRecursive(true);
+ tw.reset(ourMerger.getResultTreeId());
- assertTrue(tw.next());
- assertEquals("d/o", tw.getPathString());
- assertCorrectId(treeO, tw);
+ assertTrue(tw.next());
+ assertEquals("d/o", tw.getPathString());
+ assertCorrectId(treeO, tw);
- assertTrue(tw.next());
- assertEquals("d/t", tw.getPathString());
- assertCorrectId(treeT, tw);
+ assertTrue(tw.next());
+ assertEquals("d/t", tw.getPathString());
+ assertCorrectId(treeT, tw);
- assertFalse(tw.next());
+ assertFalse(tw.next());
+ }
}
@Test
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java
index f265315338..ac157b6b87 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java
@@ -44,7 +44,6 @@ package org.eclipse.jgit.revplot;
import static org.junit.Assert.assertEquals;
-import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -55,7 +54,6 @@ import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Ref;
-import org.eclipse.jgit.lib.Repository;
import org.junit.Before;
import org.junit.Test;
@@ -83,23 +81,18 @@ public class AbstractPlotRendererTest extends RepositoryTestCase {
git.commit().setMessage("commit on master").call();
MergeResult mergeCall = merge(db.resolve("topic"));
ObjectId start = mergeCall.getNewHead();
- PlotCommitList<PlotLane> commitList = createCommitList(start);
+ try (PlotWalk walk = new PlotWalk(db)) {
+ walk.markStart(walk.parseCommit(start));
+ PlotCommitList<PlotLane> commitList = new PlotCommitList<>();
+ commitList.source(walk);
+ commitList.fillTo(1000);
- for (int i = 0; i < commitList.size(); i++)
- plotRenderer.paintCommit(commitList.get(i), 30);
+ for (int i = 0; i < commitList.size(); i++)
+ plotRenderer.paintCommit(commitList.get(i), 30);
- List<Integer> indentations = plotRenderer.indentations;
- assertEquals(indentations.get(2), indentations.get(3));
- }
-
- private PlotCommitList<PlotLane> createCommitList(ObjectId start)
- throws IOException {
- TestPlotWalk walk = new TestPlotWalk(db);
- walk.markStart(walk.parseCommit(start));
- PlotCommitList<PlotLane> commitList = new PlotCommitList<>();
- commitList.source(walk);
- commitList.fillTo(1000);
- return commitList;
+ List<Integer> indentations = plotRenderer.indentations;
+ assertEquals(indentations.get(2), indentations.get(3));
+ }
}
private MergeResult merge(ObjectId includeId) throws GitAPIException {
@@ -107,12 +100,6 @@ public class AbstractPlotRendererTest extends RepositoryTestCase {
.include(includeId).call();
}
- private static class TestPlotWalk extends PlotWalk {
- public TestPlotWalk(Repository repo) {
- super(repo);
- }
- }
-
private static class TestPlotRenderer extends
AbstractPlotRenderer<PlotLane, Object> {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
index 7297de3646..0c367f457e 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
@@ -135,18 +135,19 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit b = commit(a);
final RevCommit c = commit(b);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(c.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(c).lanePos(0).parents(b);
- test.commit(b).lanePos(0).parents(a);
- test.commit(a).lanePos(0).parents();
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(c.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(c).lanePos(0).parents(b);
+ test.commit(b).lanePos(0).parents(a);
+ test.commit(a).lanePos(0).parents();
+ test.noMoreCommits();
+ }
}
@Test
@@ -156,19 +157,20 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit c = commit(a);
final RevCommit d = commit(b, c);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(d.getId()));
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(d.getId()));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(d).lanePos(0).parents(b, c);
- test.commit(c).lanePos(1).parents(a);
- test.commit(b).lanePos(0).parents(a);
- test.commit(a).lanePos(0).parents();
- test.noMoreCommits();
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(d).lanePos(0).parents(b, c);
+ test.commit(c).lanePos(1).parents(a);
+ test.commit(b).lanePos(0).parents(a);
+ test.commit(a).lanePos(0).parents();
+ test.noMoreCommits();
+ }
}
@Test
@@ -177,20 +179,21 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit b = commit(a);
final RevCommit c = commit(a);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(b.getId()));
- pw.markStart(pw.lookupCommit(c.getId()));
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(b.getId()));
+ pw.markStart(pw.lookupCommit(c.getId()));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
- Set<Integer> childPositions = asSet(0, 1);
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(c).lanePos(childPositions).parents(a);
- test.commit(b).lanePos(childPositions).parents(a);
- test.commit(a).lanePos(0).parents();
- test.noMoreCommits();
+ Set<Integer> childPositions = asSet(0, 1);
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(c).lanePos(childPositions).parents(a);
+ test.commit(b).lanePos(childPositions).parents(a);
+ test.commit(a).lanePos(0).parents();
+ test.noMoreCommits();
+ }
}
@Test
@@ -200,22 +203,23 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit c = commit(a);
final RevCommit d = commit(a);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(b.getId()));
- pw.markStart(pw.lookupCommit(c.getId()));
- pw.markStart(pw.lookupCommit(d.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- Set<Integer> childPositions = asSet(0, 1, 2);
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(d).lanePos(childPositions).parents(a);
- test.commit(c).lanePos(childPositions).parents(a);
- test.commit(b).lanePos(childPositions).parents(a);
- test.commit(a).lanePos(0).parents();
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(b.getId()));
+ pw.markStart(pw.lookupCommit(c.getId()));
+ pw.markStart(pw.lookupCommit(d.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ Set<Integer> childPositions = asSet(0, 1, 2);
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(d).lanePos(childPositions).parents(a);
+ test.commit(c).lanePos(childPositions).parents(a);
+ test.commit(b).lanePos(childPositions).parents(a);
+ test.commit(a).lanePos(0).parents();
+ test.noMoreCommits();
+ }
}
@Test
@@ -228,34 +232,35 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit f = commit(a);
final RevCommit g = commit(f);
- PlotWalk pw = new PlotWalk(db);
- // TODO: when we add unnecessary commit's as tips (e.g. a commit which
- // is a parent of another tip) the walk will return those commits twice.
- // Find out why!
- // pw.markStart(pw.lookupCommit(a.getId()));
- pw.markStart(pw.lookupCommit(b.getId()));
- pw.markStart(pw.lookupCommit(c.getId()));
- pw.markStart(pw.lookupCommit(d.getId()));
- pw.markStart(pw.lookupCommit(e.getId()));
- // pw.markStart(pw.lookupCommit(f.getId()));
- pw.markStart(pw.lookupCommit(g.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- Set<Integer> childPositions = asSet(0, 1, 2, 3, 4);
- CommitListAssert test = new CommitListAssert(pcl);
- int posG = test.commit(g).lanePos(childPositions).parents(f)
- .getLanePos();
- test.commit(f).lanePos(posG).parents(a);
-
- test.commit(e).lanePos(childPositions).parents(a);
- test.commit(d).lanePos(childPositions).parents(a);
- test.commit(c).lanePos(childPositions).parents(a);
- test.commit(b).lanePos(childPositions).parents(a);
- test.commit(a).lanePos(0).parents();
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ // TODO: when we add unnecessary commit's as tips (e.g. a commit
+ // which is a parent of another tip) the walk will return those
+ // commits twice. Find out why!
+ // pw.markStart(pw.lookupCommit(a.getId()));
+ pw.markStart(pw.lookupCommit(b.getId()));
+ pw.markStart(pw.lookupCommit(c.getId()));
+ pw.markStart(pw.lookupCommit(d.getId()));
+ pw.markStart(pw.lookupCommit(e.getId()));
+ // pw.markStart(pw.lookupCommit(f.getId()));
+ pw.markStart(pw.lookupCommit(g.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ Set<Integer> childPositions = asSet(0, 1, 2, 3, 4);
+ CommitListAssert test = new CommitListAssert(pcl);
+ int posG = test.commit(g).lanePos(childPositions).parents(f)
+ .getLanePos();
+ test.commit(f).lanePos(posG).parents(a);
+
+ test.commit(e).lanePos(childPositions).parents(a);
+ test.commit(d).lanePos(childPositions).parents(a);
+ test.commit(c).lanePos(childPositions).parents(a);
+ test.commit(b).lanePos(childPositions).parents(a);
+ test.commit(a).lanePos(0).parents();
+ test.noMoreCommits();
+ }
}
@Test
@@ -270,25 +275,26 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit h = commit(f);
final RevCommit i = commit(h);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(i.getId()));
- pw.markStart(pw.lookupCommit(g.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
- Set<Integer> childPositions = asSet(0, 1);
- CommitListAssert test = new CommitListAssert(pcl);
- int posI = test.commit(i).lanePos(childPositions).parents(h)
- .getLanePos();
- test.commit(h).lanePos(posI).parents(f);
- test.commit(g).lanePos(childPositions).parents(a);
- test.commit(f).lanePos(posI).parents(e, d);
- test.commit(e).lanePos(posI).parents(c);
- test.commit(d).lanePos(2).parents(b);
- test.commit(c).lanePos(posI).parents(b);
- test.commit(b).lanePos(posI).parents(a);
- test.commit(a).lanePos(0).parents();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(i.getId()));
+ pw.markStart(pw.lookupCommit(g.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+ Set<Integer> childPositions = asSet(0, 1);
+ CommitListAssert test = new CommitListAssert(pcl);
+ int posI = test.commit(i).lanePos(childPositions).parents(h)
+ .getLanePos();
+ test.commit(h).lanePos(posI).parents(f);
+ test.commit(g).lanePos(childPositions).parents(a);
+ test.commit(f).lanePos(posI).parents(e, d);
+ test.commit(e).lanePos(posI).parents(c);
+ test.commit(d).lanePos(2).parents(b);
+ test.commit(c).lanePos(posI).parents(b);
+ test.commit(b).lanePos(posI).parents(a);
+ test.commit(a).lanePos(0).parents();
+ }
}
// test the history of the egit project between 9fdaf3c1 and e76ad9170f
@@ -330,67 +336,71 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit merge_fixed_logged_npe = commit(sort_roots,
fix_logged_npe);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- CommitListAssert test = new CommitListAssert(pcl);
-
- // Note: all positions of side branches are rather arbitrary, but some
- // may not overlap. Testing for the positions yielded by the current
- // implementation, which was manually checked to not overlap.
- final int mainPos = 0;
- test.commit(merge_fixed_logged_npe).parents(sort_roots, fix_logged_npe)
- .lanePos(mainPos);
- test.commit(fix_logged_npe).parents(merge_changeset_implementation)
- .lanePos(1);
- test.commit(sort_roots).parents(merge_update_eclipse).lanePos(mainPos);
- test.commit(merge_update_eclipse).parents(add_a_clear, update_eclipse)
- .lanePos(mainPos);
- test.commit(add_a_clear).parents(fix_broken).lanePos(mainPos);
- test.commit(fix_broken).parents(merge_disable_comment).lanePos(mainPos);
- test.commit(merge_disable_comment)
- .parents(merge_resolve_handler, disable_comment)
- .lanePos(mainPos);
- test.commit(disable_comment).parents(clone_operation).lanePos(2);
- test.commit(merge_resolve_handler)
- .parents(clone_operation, resolve_handler).lanePos(mainPos);
- test.commit(update_eclipse).parents(add_Maven).lanePos(3);
- test.commit(clone_operation).parents(merge_changeset_implementation)
- .lanePos(mainPos);
- test.commit(merge_changeset_implementation)
- .parents(merge_disable_source, changeset_implementation)
- .lanePos(mainPos);
- test.commit(merge_disable_source)
- .parents(update_eclipse_iplog2, disable_source)
- .lanePos(mainPos);
- test.commit(update_eclipse_iplog2).parents(merge_use_remote)
- .lanePos(mainPos);
- test.commit(disable_source).parents(merge_use_remote).lanePos(1);
- test.commit(merge_use_remote).parents(update_eclipse_iplog, use_remote)
- .lanePos(mainPos);
- test.commit(changeset_implementation).parents(clear_repositorycache)
- .lanePos(2);
- test.commit(update_eclipse_iplog).parents(merge_add_Maven)
- .lanePos(mainPos);
- test.commit(merge_add_Maven).parents(findToolBar_layout, add_Maven)
- .lanePos(mainPos);
- test.commit(findToolBar_layout).parents(clear_repositorycache)
- .lanePos(mainPos);
- test.commit(use_remote).parents(clear_repositorycache).lanePos(1);
- test.commit(add_Maven).parents(clear_repositorycache).lanePos(3);
- test.commit(clear_repositorycache).parents(merge_remove)
- .lanePos(mainPos);
- test.commit(resolve_handler).parents(merge_fix).lanePos(4);
- test.commit(merge_remove).parents(add_simple, remove_unused)
- .lanePos(mainPos);
- test.commit(remove_unused).parents(merge_fix).lanePos(1);
- test.commit(add_simple).parents(merge_fix).lanePos(mainPos);
- test.commit(merge_fix).parents().lanePos(mainPos);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ CommitListAssert test = new CommitListAssert(pcl);
+
+ // Note: all positions of side branches are rather arbitrary, but
+ // some
+ // may not overlap. Testing for the positions yielded by the current
+ // implementation, which was manually checked to not overlap.
+ final int mainPos = 0;
+ test.commit(merge_fixed_logged_npe)
+ .parents(sort_roots, fix_logged_npe).lanePos(mainPos);
+ test.commit(fix_logged_npe).parents(merge_changeset_implementation)
+ .lanePos(1);
+ test.commit(sort_roots).parents(merge_update_eclipse)
+ .lanePos(mainPos);
+ test.commit(merge_update_eclipse)
+ .parents(add_a_clear, update_eclipse).lanePos(mainPos);
+ test.commit(add_a_clear).parents(fix_broken).lanePos(mainPos);
+ test.commit(fix_broken).parents(merge_disable_comment)
+ .lanePos(mainPos);
+ test.commit(merge_disable_comment)
+ .parents(merge_resolve_handler, disable_comment)
+ .lanePos(mainPos);
+ test.commit(disable_comment).parents(clone_operation).lanePos(2);
+ test.commit(merge_resolve_handler)
+ .parents(clone_operation, resolve_handler).lanePos(mainPos);
+ test.commit(update_eclipse).parents(add_Maven).lanePos(3);
+ test.commit(clone_operation).parents(merge_changeset_implementation)
+ .lanePos(mainPos);
+ test.commit(merge_changeset_implementation)
+ .parents(merge_disable_source, changeset_implementation)
+ .lanePos(mainPos);
+ test.commit(merge_disable_source)
+ .parents(update_eclipse_iplog2, disable_source)
+ .lanePos(mainPos);
+ test.commit(update_eclipse_iplog2).parents(merge_use_remote)
+ .lanePos(mainPos);
+ test.commit(disable_source).parents(merge_use_remote).lanePos(1);
+ test.commit(merge_use_remote)
+ .parents(update_eclipse_iplog, use_remote).lanePos(mainPos);
+ test.commit(changeset_implementation).parents(clear_repositorycache)
+ .lanePos(2);
+ test.commit(update_eclipse_iplog).parents(merge_add_Maven)
+ .lanePos(mainPos);
+ test.commit(merge_add_Maven).parents(findToolBar_layout, add_Maven)
+ .lanePos(mainPos);
+ test.commit(findToolBar_layout).parents(clear_repositorycache)
+ .lanePos(mainPos);
+ test.commit(use_remote).parents(clear_repositorycache).lanePos(1);
+ test.commit(add_Maven).parents(clear_repositorycache).lanePos(3);
+ test.commit(clear_repositorycache).parents(merge_remove)
+ .lanePos(mainPos);
+ test.commit(resolve_handler).parents(merge_fix).lanePos(4);
+ test.commit(merge_remove).parents(add_simple, remove_unused)
+ .lanePos(mainPos);
+ test.commit(remove_unused).parents(merge_fix).lanePos(1);
+ test.commit(add_simple).parents(merge_fix).lanePos(mainPos);
+ test.commit(merge_fix).parents().lanePos(mainPos);
+ test.noMoreCommits();
+ }
}
// test a history where a merge commit has two time the same parent
@@ -403,20 +413,21 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit s1 = commit(m2);
final RevCommit s2 = commit(s1);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(m3));
- pw.markStart(pw.lookupCommit(s2));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(s2).nrOfPassingLanes(0);
- test.commit(s1).nrOfPassingLanes(0);
- test.commit(m3).nrOfPassingLanes(1);
- test.commit(m2).nrOfPassingLanes(0);
- test.commit(m1).nrOfPassingLanes(0);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(m3));
+ pw.markStart(pw.lookupCommit(s2));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(s2).nrOfPassingLanes(0);
+ test.commit(s1).nrOfPassingLanes(0);
+ test.commit(m3).nrOfPassingLanes(1);
+ test.commit(m2).nrOfPassingLanes(0);
+ test.commit(m1).nrOfPassingLanes(0);
+ test.noMoreCommits();
+ }
}
/**
@@ -465,30 +476,31 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit a4 = commit(a3);
final RevCommit a5 = commit(a3, a4);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(b3.getId()));
- pw.markStart(pw.lookupCommit(c.getId()));
- pw.markStart(pw.lookupCommit(e.getId()));
- pw.markStart(pw.lookupCommit(a5.getId()));
-
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- // test that the commits b1, b2 and b3 are on the same position
- int bPos = pcl.get(9).lane.position; // b1
- assertEquals("b2 is an a different position", bPos,
- pcl.get(7).lane.position);
- assertEquals("b3 is on a different position", bPos,
- pcl.get(4).lane.position);
-
- // test that nothing blocks the connections between b1, b2 and b3
- assertNotEquals("b lane is blocked by c", bPos,
- pcl.get(8).lane.position);
- assertNotEquals("b lane is blocked by a2", bPos,
- pcl.get(6).lane.position);
- assertNotEquals("b lane is blocked by d", bPos,
- pcl.get(5).lane.position);
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(b3.getId()));
+ pw.markStart(pw.lookupCommit(c.getId()));
+ pw.markStart(pw.lookupCommit(e.getId()));
+ pw.markStart(pw.lookupCommit(a5.getId()));
+
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ // test that the commits b1, b2 and b3 are on the same position
+ int bPos = pcl.get(9).lane.position; // b1
+ assertEquals("b2 is an a different position", bPos,
+ pcl.get(7).lane.position);
+ assertEquals("b3 is on a different position", bPos,
+ pcl.get(4).lane.position);
+
+ // test that nothing blocks the connections between b1, b2 and b3
+ assertNotEquals("b lane is blocked by c", bPos,
+ pcl.get(8).lane.position);
+ assertNotEquals("b lane is blocked by a2", bPos,
+ pcl.get(6).lane.position);
+ assertNotEquals("b lane is blocked by d", bPos,
+ pcl.get(5).lane.position);
+ }
}
/**
@@ -517,23 +529,24 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit a4 = commit(a3, b2);
final RevCommit b3 = commit(b2);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a4));
- pw.markStart(pw.lookupCommit(b3));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- Set<Integer> positions = asSet(0, 1);
- CommitListAssert test = new CommitListAssert(pcl);
- int posB = test.commit(b3).lanePos(positions).getLanePos();
- int posA = test.commit(a4).lanePos(positions).getLanePos();
- test.commit(b2).lanePos(posB);
- test.commit(a3).lanePos(posA);
- test.commit(a2).lanePos(posA);
- test.commit(b1).lanePos(posB);
- test.commit(a1).lanePos(posA);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a4));
+ pw.markStart(pw.lookupCommit(b3));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ Set<Integer> positions = asSet(0, 1);
+ CommitListAssert test = new CommitListAssert(pcl);
+ int posB = test.commit(b3).lanePos(positions).getLanePos();
+ int posA = test.commit(a4).lanePos(positions).getLanePos();
+ test.commit(b2).lanePos(posB);
+ test.commit(a3).lanePos(posA);
+ test.commit(a2).lanePos(posA);
+ test.commit(b1).lanePos(posB);
+ test.commit(a1).lanePos(posA);
+ test.noMoreCommits();
+ }
}
/**
@@ -562,25 +575,26 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit b3 = commit(b2);
final RevCommit a4 = commit(a3);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a4));
- pw.markStart(pw.lookupCommit(b3));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- Set<Integer> positions = asSet(0, 1);
- CommitListAssert test = new CommitListAssert(pcl);
- int posA = test.commit(a4).lanePos(positions).getLanePos();
- int posB = test.commit(b3).lanePos(positions).getLanePos();
- test.commit(a3).lanePos(posA);
- test.commit(b2).lanePos(posB);
- test.commit(a2).lanePos(posA);
- // b1 is not repositioned, uses "detour lane"
- // (drawn as a double arc in the ascii graph above)
- test.commit(b1).lanePos(posB);
- test.commit(a1).lanePos(posA);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a4));
+ pw.markStart(pw.lookupCommit(b3));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ Set<Integer> positions = asSet(0, 1);
+ CommitListAssert test = new CommitListAssert(pcl);
+ int posA = test.commit(a4).lanePos(positions).getLanePos();
+ int posB = test.commit(b3).lanePos(positions).getLanePos();
+ test.commit(a3).lanePos(posA);
+ test.commit(b2).lanePos(posB);
+ test.commit(a2).lanePos(posA);
+ // b1 is not repositioned, uses "detour lane"
+ // (drawn as a double arc in the ascii graph above)
+ test.commit(b1).lanePos(posB);
+ test.commit(a1).lanePos(posA);
+ test.noMoreCommits();
+ }
}
/**
@@ -611,24 +625,25 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit a4 = commit(a3, b1);
final RevCommit b2 = commit(b1);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a4));
- pw.markStart(pw.lookupCommit(b2));
- pw.markStart(pw.lookupCommit(c));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- Set<Integer> positions = asSet(0, 1, 2);
- CommitListAssert test = new CommitListAssert(pcl);
- int posB = test.commit(b2).lanePos(positions).getLanePos();
- int posA = test.commit(a4).lanePos(positions).getLanePos();
- test.commit(a3).lanePos(posA);
- test.commit(c).lanePos(positions);
- test.commit(a2).lanePos(posA);
- test.commit(b1).lanePos(posB); // repositioned to go around c
- test.commit(a1).lanePos(posA);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a4));
+ pw.markStart(pw.lookupCommit(b2));
+ pw.markStart(pw.lookupCommit(c));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ Set<Integer> positions = asSet(0, 1, 2);
+ CommitListAssert test = new CommitListAssert(pcl);
+ int posB = test.commit(b2).lanePos(positions).getLanePos();
+ int posA = test.commit(a4).lanePos(positions).getLanePos();
+ test.commit(a3).lanePos(posA);
+ test.commit(c).lanePos(positions);
+ test.commit(a2).lanePos(posA);
+ test.commit(b1).lanePos(posB); // repositioned to go around c
+ test.commit(a1).lanePos(posA);
+ test.noMoreCommits();
+ }
}
/**
@@ -651,22 +666,24 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit a3 = commit(a2);
final RevCommit b1 = commit(a1);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a3));
- pw.markStart(pw.lookupCommit(b1));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(2); // don't process a1
-
- Set<Integer> positions = asSet(0, 1);
- CommitListAssert test = new CommitListAssert(pcl);
- PlotLane laneB = test.commit(b1).lanePos(positions).current.getLane();
- int posA = test.commit(a3).lanePos(positions).getLanePos();
- test.commit(a2).lanePos(posA);
- assertArrayEquals(
- "Although the parent of b1, a1, is not processed yet, the b lane should still be drawn",
- new PlotLane[] { laneB }, test.current.passingLanes);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a3));
+ pw.markStart(pw.lookupCommit(b1));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(2); // don't process a1
+
+ Set<Integer> positions = asSet(0, 1);
+ CommitListAssert test = new CommitListAssert(pcl);
+ PlotLane laneB = test.commit(b1).lanePos(positions).current
+ .getLane();
+ int posA = test.commit(a3).lanePos(positions).getLanePos();
+ test.commit(a2).lanePos(posA);
+ assertArrayEquals(
+ "Although the parent of b1, a1, is not processed yet, the b lane should still be drawn",
+ new PlotLane[] { laneB }, test.current.passingLanes);
+ test.noMoreCommits();
+ }
}
@Test
@@ -674,17 +691,18 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit a = commit();
final RevCommit b = commit();
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a));
- pw.markStart(pw.lookupCommit(b));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(b).lanePos(0);
- test.commit(a).lanePos(0);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a));
+ pw.markStart(pw.lookupCommit(b));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(b).lanePos(0);
+ test.commit(a).lanePos(0);
+ test.noMoreCommits();
+ }
}
@Test
@@ -693,17 +711,18 @@ public class PlotCommitListTest extends RevWalkTestCase {
final RevCommit b1 = commit();
final RevCommit b2 = commit(b1);
- PlotWalk pw = new PlotWalk(db);
- pw.markStart(pw.lookupCommit(a));
- pw.markStart(pw.lookupCommit(b2));
- PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
- pcl.source(pw);
- pcl.fillTo(Integer.MAX_VALUE);
-
- CommitListAssert test = new CommitListAssert(pcl);
- test.commit(b2).lanePos(0);
- test.commit(b1).lanePos(0);
- test.commit(a).lanePos(0);
- test.noMoreCommits();
+ try (PlotWalk pw = new PlotWalk(db)) {
+ pw.markStart(pw.lookupCommit(a));
+ pw.markStart(pw.lookupCommit(b2));
+ PlotCommitList<PlotLane> pcl = new PlotCommitList<>();
+ pcl.source(pw);
+ pcl.fillTo(Integer.MAX_VALUE);
+
+ CommitListAssert test = new CommitListAssert(pcl);
+ test.commit(b2).lanePos(0);
+ test.commit(b1).lanePos(0);
+ test.commit(a).lanePos(0);
+ test.noMoreCommits();
+ }
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
index b814984935..d6b63ab236 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitParseTest.java
@@ -107,18 +107,18 @@ public class RevCommitParseTest extends RepositoryTestCase {
body.append("\n");
- final RevWalk rw = new RevWalk(db);
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
assertNull(c.getTree());
assertNull(c.parents);
- c.parseCanonical(rw, body.toString().getBytes(UTF_8));
- assertNotNull(c.getTree());
- assertEquals(treeId, c.getTree().getId());
- assertSame(rw.lookupTree(treeId), c.getTree());
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+ assertNotNull(c.getTree());
+ assertEquals(treeId, c.getTree().getId());
+ assertSame(rw.lookupTree(treeId), c.getTree());
+ }
assertNotNull(c.parents);
assertEquals(0, c.parents.length);
assertEquals("", c.getFullMessage());
@@ -148,8 +148,10 @@ public class RevCommitParseTest extends RepositoryTestCase {
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
- return c;
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+ return c;
+ }
}
@Test
@@ -161,8 +163,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+ }
assertEquals("", c.getFullMessage());
assertEquals("", c.getShortMessage());
}
@@ -176,8 +179,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+ }
assertEquals(new PersonIdent("", "a_u_thor@example.com", 1218123387000l, 7), c.getAuthorIdent());
assertEquals(new PersonIdent("", "", 1218123390000l, -5), c.getCommitterIdent());
}
@@ -194,8 +198,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
- c.parseCanonical(new RevWalk(db), b.toByteArray());
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertSame(UTF_8, c.getEncoding());
assertEquals("F\u00f6r fattare", c.getAuthorIdent().getName());
assertEquals("Sm\u00f6rg\u00e5sbord", c.getShortMessage());
@@ -214,8 +219,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
- c.parseCanonical(new RevWalk(db), b.toByteArray());
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertSame(UTF_8, c.getEncoding());
assertEquals("F\u00f6r fattare", c.getAuthorIdent().getName());
assertEquals("Sm\u00f6rg\u00e5sbord", c.getShortMessage());
@@ -240,7 +246,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes("EUC-JP"));
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("EUC-JP", c.getEncoding().name());
assertEquals("F\u00f6r fattare", c.getAuthorIdent().getName());
@@ -270,7 +278,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes(UTF_8));
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("EUC-JP", c.getEncoding().name());
assertEquals("F\u00f6r fattare", c.getAuthorIdent().getName());
@@ -301,7 +311,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes(UTF_8));
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67")); // bogus id
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("ISO-8859-1", c.getEncoding().name());
assertEquals("F\u00f6r fattare", c.getAuthorIdent().getName());
@@ -323,7 +335,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
RevCommit c = new RevCommit(
id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("'utf8'", c.getEncodingName());
assertEquals("Sm\u00f6rg\u00e5sbord\n", c.getFullMessage());
@@ -347,7 +361,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
RevCommit c = new RevCommit(
id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("utf-8logoutputencoding=gbk", c.getEncodingName());
assertEquals("message\n", c.getFullMessage());
assertEquals("message", c.getShortMessage());
@@ -374,7 +390,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
RevCommit c = new RevCommit(
id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("it_IT.UTF8", c.getEncodingName());
assertEquals("message\n", c.getFullMessage());
assertEquals("message", c.getShortMessage());
@@ -507,7 +525,9 @@ public class RevCommitParseTest extends RepositoryTestCase {
final RevCommit c;
c = new RevCommit(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), commit.getBytes(UTF_8));
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, commit.getBytes(UTF_8));
+ }
String gpgSig = new String(c.getRawGpgSignature(), UTF_8);
assertTrue(gpgSig.startsWith("-----BEGIN"));
assertTrue(gpgSig.endsWith("END PGP SIGNATURE-----"));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
index 1b45473066..bbc559b2db 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevTagParseTest.java
@@ -91,17 +91,18 @@ public class RevTagParseTest extends RepositoryTestCase {
b.append("tagger A U. Thor <a_u_thor@example.com> 1218123387 +0700\n");
b.append("\n");
- final RevWalk rw = new RevWalk(db);
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
assertNull(c.getObject());
assertNull(c.getTagName());
- c.parseCanonical(rw, b.toString().getBytes(UTF_8));
- assertNotNull(c.getObject());
- assertEquals(id, c.getObject().getId());
- assertSame(rw.lookupAny(id, typeCode), c.getObject());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+ assertNotNull(c.getObject());
+ assertEquals(id, c.getObject().getId());
+ assertSame(rw.lookupAny(id, typeCode), c.getObject());
+ }
}
@Test
@@ -134,18 +135,18 @@ public class RevTagParseTest extends RepositoryTestCase {
body.append("\n");
- final RevWalk rw = new RevWalk(db);
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
assertNull(c.getObject());
assertNull(c.getTagName());
- c.parseCanonical(rw, body.toString().getBytes(UTF_8));
- assertNotNull(c.getObject());
- assertEquals(treeId, c.getObject().getId());
- assertSame(rw.lookupTree(treeId), c.getObject());
-
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+ assertNotNull(c.getObject());
+ assertEquals(treeId, c.getObject().getId());
+ assertSame(rw.lookupTree(treeId), c.getObject());
+ }
assertNotNull(c.getTagName());
assertEquals(name, c.getTagName());
assertEquals("", c.getFullMessage());
@@ -182,17 +183,18 @@ public class RevTagParseTest extends RepositoryTestCase {
body.append("\n");
body.append(message);
- final RevWalk rw = new RevWalk(db);
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
assertNull(c.getObject());
assertNull(c.getTagName());
- c.parseCanonical(rw, body.toString().getBytes(UTF_8));
- assertNotNull(c.getObject());
- assertEquals(treeId, c.getObject().getId());
- assertSame(rw.lookupTree(treeId), c.getObject());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, body.toString().getBytes(UTF_8));
+ assertNotNull(c.getObject());
+ assertEquals(treeId, c.getObject().getId());
+ assertSame(rw.lookupTree(treeId), c.getObject());
+ }
assertNotNull(c.getTagName());
assertEquals(name, c.getTagName());
@@ -213,7 +215,9 @@ public class RevTagParseTest extends RepositoryTestCase {
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toString().getBytes(UTF_8));
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toString().getBytes(UTF_8));
+ }
return c;
}
@@ -234,7 +238,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("F\u00f6r fattare", c.getTaggerIdent().getName());
assertEquals("Sm\u00f6rg\u00e5sbord", c.getShortMessage());
@@ -257,7 +263,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("\u304d\u308c\u3044\n".getBytes(UTF_8));
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("F\u00f6r fattare", c.getTaggerIdent().getName());
assertEquals("Sm\u00f6rg\u00e5sbord", c.getShortMessage());
@@ -287,7 +295,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes("EUC-JP"));
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("F\u00f6r fattare", c.getTaggerIdent().getName());
assertEquals("\u304d\u308c\u3044", c.getShortMessage());
@@ -320,7 +330,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes(UTF_8));
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("F\u00f6r fattare", c.getTaggerIdent().getName());
assertEquals("\u304d\u308c\u3044", c.getShortMessage());
@@ -355,7 +367,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("Hi\n".getBytes(UTF_8));
final RevTag c;
c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- c.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ c.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("F\u00f6r fattare", c.getTaggerIdent().getName());
assertEquals("\u304d\u308c\u3044", c.getShortMessage());
@@ -374,7 +388,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("message\n".getBytes(UTF_8));
RevTag t = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- t.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ t.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("t", t.getTaggerIdent().getName());
assertEquals("message", t.getShortMessage());
@@ -393,7 +409,9 @@ public class RevTagParseTest extends RepositoryTestCase {
b.write("message\n".getBytes(UTF_8));
RevTag t = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
- t.parseCanonical(new RevWalk(db), b.toByteArray());
+ try (RevWalk rw = new RevWalk(db)) {
+ t.parseCanonical(rw, b.toByteArray());
+ }
assertEquals("t", t.getTaggerIdent().getName());
assertEquals("message", t.getShortMessage());
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/TreeRevFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/TreeRevFilterTest.java
index 9548992a2b..a345459b3b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/TreeRevFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/TreeRevFilterTest.java
@@ -46,25 +46,15 @@ package org.eclipse.jgit.revwalk;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import java.util.Collections;
-
import org.eclipse.jgit.revwalk.filter.OrRevFilter;
import org.eclipse.jgit.revwalk.filter.RevFilter;
import org.eclipse.jgit.revwalk.filter.SkipRevFilter;
-import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
-import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
import org.junit.Test;
public class TreeRevFilterTest extends RevWalkTestCase {
- private RevFilter treeRevFilter(String path) {
- return new TreeRevFilter(rw, treeFilter(path));
- }
-
- private static TreeFilter treeFilter(String path) {
- return AndTreeFilter.create(
- PathFilterGroup.createFromStrings(Collections.singleton(path)),
- TreeFilter.ANY_DIFF);
+ private RevFilter treeRevFilter() {
+ return new TreeRevFilter(rw, TreeFilter.ANY_DIFF);
}
@Test
@@ -73,7 +63,7 @@ public class TreeRevFilterTest extends RevWalkTestCase {
RevCommit a = commit(tree(file("d/f", blob("a"))));
RevCommit b = commit(tree(file("d/f", blob("a"))), a);
RevCommit c = commit(tree(file("d/f", blob("b"))), b);
- rw.setRevFilter(treeRevFilter("d/f"));
+ rw.setRevFilter(treeRevFilter());
markStart(c);
assertCommit(c, rw.next());
@@ -91,7 +81,7 @@ public class TreeRevFilterTest extends RevWalkTestCase {
RevCommit b = commit(tree(file("d/f", blob("a"))), a);
RevCommit c = commit(tree(file("d/f", blob("b"))), b);
RevCommit d = commit(tree(file("d/f", blob("b"))), c);
- rw.setRevFilter(treeRevFilter("d/f"));
+ rw.setRevFilter(treeRevFilter());
markStart(d);
// d was skipped
@@ -111,7 +101,7 @@ public class TreeRevFilterTest extends RevWalkTestCase {
RevCommit b = commit(tree(file("d/f", blob("a"))), a);
RevCommit c = commit(tree(file("d/f", blob("b"))), b);
RevCommit d = commit(tree(file("d/f", blob("b"))), c);
- rw.setRevFilter(treeRevFilter("d"));
+ rw.setRevFilter(treeRevFilter());
markStart(d);
// d was skipped
@@ -136,7 +126,7 @@ public class TreeRevFilterTest extends RevWalkTestCase {
RevCommit g = commit(tree(file("d/f", blob("b"))), f);
RevCommit h = commit(tree(file("d/f", blob("b"))), g);
RevCommit i = commit(tree(file("d/f", blob("c"))), h);
- rw.setRevFilter(treeRevFilter("d/f"));
+ rw.setRevFilter(treeRevFilter());
markStart(i);
assertCommit(i, rw.next());
@@ -156,7 +146,7 @@ public class TreeRevFilterTest extends RevWalkTestCase {
@Test
public void testPathFilterOrOtherFilter() throws Exception {
- RevFilter pathFilter = treeRevFilter("d/f");
+ RevFilter pathFilter = treeRevFilter();
RevFilter skipFilter = SkipRevFilter.create(1);
RevFilter orFilter = OrRevFilter.create(skipFilter, pathFilter);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java
index 1ff64a2e28..80e9e6b14b 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleAddTest.java
@@ -135,20 +135,20 @@ public class SubmoduleAddTest extends RepositoryTestCase {
subCommit = repo.resolve(Constants.HEAD);
}
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- generator.loadModulesConfig();
- assertTrue(generator.next());
- assertEquals(path, generator.getModuleName());
- assertEquals(path, generator.getPath());
- assertEquals(commit, generator.getObjectId());
- assertEquals(uri, generator.getModulesUrl());
- assertEquals(path, generator.getModulesPath());
- assertEquals(uri, generator.getConfigUrl());
- try (Repository subModRepo = generator.getRepository()) {
- assertNotNull(subModRepo);
- assertEquals(subCommit, commit);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ generator.loadModulesConfig();
+ assertTrue(generator.next());
+ assertEquals(path, generator.getModuleName());
+ assertEquals(path, generator.getPath());
+ assertEquals(commit, generator.getObjectId());
+ assertEquals(uri, generator.getModulesUrl());
+ assertEquals(path, generator.getModulesPath());
+ assertEquals(uri, generator.getConfigUrl());
+ try (Repository subModRepo = generator.getRepository()) {
+ assertNotNull(subModRepo);
+ assertEquals(subCommit, commit);
+ }
}
-
Status status = Git.wrap(db).status().call();
assertTrue(status.getAdded().contains(Constants.DOT_GIT_MODULES));
assertTrue(status.getAdded().contains(path));
@@ -175,20 +175,20 @@ public class SubmoduleAddTest extends RepositoryTestCase {
subCommit = repo.resolve(Constants.HEAD);
}
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- generator.loadModulesConfig();
- assertTrue(generator.next());
- assertEquals(name, generator.getModuleName());
- assertEquals(path, generator.getPath());
- assertEquals(commit, generator.getObjectId());
- assertEquals(uri, generator.getModulesUrl());
- assertEquals(path, generator.getModulesPath());
- assertEquals(uri, generator.getConfigUrl());
- try (Repository subModRepo = generator.getRepository()) {
- assertNotNull(subModRepo);
- assertEquals(subCommit, commit);
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ generator.loadModulesConfig();
+ assertTrue(generator.next());
+ assertEquals(name, generator.getModuleName());
+ assertEquals(path, generator.getPath());
+ assertEquals(commit, generator.getObjectId());
+ assertEquals(uri, generator.getModulesUrl());
+ assertEquals(path, generator.getModulesPath());
+ assertEquals(uri, generator.getConfigUrl());
+ try (Repository subModRepo = generator.getRepository()) {
+ assertNotNull(subModRepo);
+ assertEquals(subCommit, commit);
+ }
}
-
Status status = Git.wrap(db).status().call();
assertTrue(status.getAdded().contains(Constants.DOT_GIT_MODULES));
assertTrue(status.getAdded().contains(path));
@@ -269,24 +269,25 @@ public class SubmoduleAddTest extends RepositoryTestCase {
assertNotNull(repo);
addRepoToClose(repo);
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(path, generator.getPath());
- assertEquals(commit, generator.getObjectId());
- assertEquals(uri, generator.getModulesUrl());
- assertEquals(path, generator.getModulesPath());
- String fullUri = db.getDirectory().getAbsolutePath();
- if (File.separatorChar == '\\') {
- fullUri = fullUri.replace('\\', '/');
- }
- assertEquals(fullUri, generator.getConfigUrl());
- try (Repository subModRepo = generator.getRepository()) {
- assertNotNull(subModRepo);
- assertEquals(fullUri,
- subModRepo.getConfig().getString(
- ConfigConstants.CONFIG_REMOTE_SECTION,
- Constants.DEFAULT_REMOTE_NAME,
- ConfigConstants.CONFIG_KEY_URL));
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(path, generator.getPath());
+ assertEquals(commit, generator.getObjectId());
+ assertEquals(uri, generator.getModulesUrl());
+ assertEquals(path, generator.getModulesPath());
+ String fullUri = db.getDirectory().getAbsolutePath();
+ if (File.separatorChar == '\\') {
+ fullUri = fullUri.replace('\\', '/');
+ }
+ assertEquals(fullUri, generator.getConfigUrl());
+ try (Repository subModRepo = generator.getRepository()) {
+ assertNotNull(subModRepo);
+ assertEquals(fullUri,
+ subModRepo.getConfig().getString(
+ ConfigConstants.CONFIG_REMOTE_SECTION,
+ Constants.DEFAULT_REMOTE_NAME,
+ ConfigConstants.CONFIG_KEY_URL));
+ }
}
assertEquals(commit, repo.resolve(Constants.HEAD));
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
index 815ce9b350..bb0085106d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleDeinitTest.java
@@ -107,7 +107,6 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
assertEquals(1, updated.size());
File submoduleDir = assertSubmoduleIsInitialized();
- SubmoduleWalk generator;
write(new File(submoduleDir, "untracked"), "untracked");
@@ -115,8 +114,9 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ }
assertTrue(submoduleDir.isDirectory());
assertNotEquals(0, submoduleDir.list().length);
}
@@ -132,33 +132,36 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
assertEquals(1, updated.size());
File submoduleDir = assertSubmoduleIsInitialized();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- generator.next();
-
- //want to create a commit inside the repo...
- try (Repository submoduleLocalRepo = generator.getRepository()) {
- JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt",
- "new data");
- Git.wrap(submoduleLocalRepo).commit().setAll(true)
- .setMessage("local commit").call();
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ generator.next();
+
+ // want to create a commit inside the repo...
+ try (Repository submoduleLocalRepo = generator.getRepository()) {
+ JGitTestUtil.writeTrashFile(submoduleLocalRepo, "file.txt",
+ "new data");
+ Git.wrap(submoduleLocalRepo).commit().setAll(true)
+ .setMessage("local commit").call();
+ }
}
SubmoduleDeinitResult result = runDeinit(new SubmoduleDeinitCommand(db).addPath("sub"));
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.DIRTY, result.getStatus());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ }
assertTrue(submoduleDir.isDirectory());
assertNotEquals(0, submoduleDir.list().length);
}
private File assertSubmoduleIsInitialized() throws IOException {
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- File submoduleDir = new File(db.getWorkTree(), generator.getPath());
- assertTrue(submoduleDir.isDirectory());
- assertNotEquals(0, submoduleDir.list().length);
- return submoduleDir;
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ File submoduleDir = new File(db.getWorkTree(), generator.getPath());
+ assertTrue(submoduleDir.isDirectory());
+ assertNotEquals(0, submoduleDir.list().length);
+ return submoduleDir;
+ }
}
@Test
@@ -180,8 +183,9 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.FORCED, result.getStatus());
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ }
assertTrue(submoduleDir.isDirectory());
assertEquals(0, submoduleDir.list().length);
}
@@ -202,8 +206,9 @@ public class SubmoduleDeinitTest extends RepositoryTestCase {
assertEquals(path, result.getPath());
assertEquals(SubmoduleDeinitCommand.SubmoduleDeinitStatus.SUCCESS, result.getStatus());
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ }
assertTrue(submoduleDir.isDirectory());
assertEquals(0, submoduleDir.list().length);
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java
index c7a009c5bf..9fe2fc6fdc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleInitTest.java
@@ -86,11 +86,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
ConfigInvalidException, GitAPIException {
final String path = addSubmoduleToIndex();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
@@ -109,10 +109,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
assertEquals(1, modules.size());
assertEquals(path, modules.iterator().next());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(url, generator.getConfigUrl());
- assertEquals(update, generator.getConfigUpdate());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(url, generator.getConfigUrl());
+ assertEquals(update, generator.getConfigUpdate());
+ }
}
@Test
@@ -126,11 +127,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
base);
config.save();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
@@ -149,10 +150,12 @@ public class SubmoduleInitTest extends RepositoryTestCase {
assertEquals(1, modules.size());
assertEquals(path, modules.iterator().next());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals("git://server/repo.git/sub.git", generator.getConfigUrl());
- assertEquals(update, generator.getConfigUpdate());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals("git://server/repo.git/sub.git",
+ generator.getConfigUrl());
+ assertEquals(update, generator.getConfigUpdate());
+ }
}
@Test
@@ -167,11 +170,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
base);
config.save();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
@@ -190,10 +193,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
assertEquals(1, modules.size());
assertEquals(path, modules.iterator().next());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals("git://server/sub.git", generator.getConfigUrl());
- assertEquals(update, generator.getConfigUpdate());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals("git://server/sub.git", generator.getConfigUrl());
+ assertEquals(update, generator.getConfigUpdate());
+ }
}
@Test
@@ -208,11 +212,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
base);
config.save();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
@@ -231,10 +235,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
assertEquals(1, modules.size());
assertEquals(path, modules.iterator().next());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals("git://server2/sub.git", generator.getConfigUrl());
- assertEquals(update, generator.getConfigUpdate());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals("git://server2/sub.git", generator.getConfigUrl());
+ assertEquals(update, generator.getConfigUpdate());
+ }
}
@Test
@@ -250,11 +255,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
Constants.DEFAULT_REMOTE_NAME, ConfigConstants.CONFIG_KEY_URL);
config.save();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
@@ -273,10 +278,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
assertEquals(1, modules.size());
assertEquals(path, modules.iterator().next());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(base + "/sub.git", generator.getConfigUrl());
- assertEquals(update, generator.getConfigUpdate());
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(base + "/sub.git", generator.getConfigUrl());
+ assertEquals(update, generator.getConfigUpdate());
+ }
}
@Test
@@ -291,11 +297,11 @@ public class SubmoduleInitTest extends RepositoryTestCase {
base);
config.save();
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertNull(generator.getConfigUpdate());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertNull(generator.getConfigUpdate());
+ }
FileBasedConfig modulesConfig = new FileBasedConfig(new File(
db.getWorkTree(), Constants.DOT_GIT_MODULES), db.getFS());
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java
index 6f3b52f7bb..1053e31bc9 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleSyncTest.java
@@ -119,11 +119,11 @@ public class SubmoduleSyncTest extends RepositoryTestCase {
addRepoToClose(subRepo);
assertNotNull(subRepo);
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertEquals(url, generator.getModulesUrl());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertEquals(url, generator.getModulesUrl());
+ }
SubmoduleSyncCommand command = new SubmoduleSyncCommand(db);
Map<String, String> synced = command.call();
assertNotNull(synced);
@@ -132,16 +132,17 @@ public class SubmoduleSyncTest extends RepositoryTestCase {
assertEquals(path, module.getKey());
assertEquals(url, module.getValue());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals(url, generator.getConfigUrl());
- try (Repository subModRepository = generator.getRepository()) {
- StoredConfig submoduleConfig = subModRepository.getConfig();
- assertEquals(url,
- submoduleConfig.getString(
- ConfigConstants.CONFIG_REMOTE_SECTION,
- Constants.DEFAULT_REMOTE_NAME,
- ConfigConstants.CONFIG_KEY_URL));
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals(url, generator.getConfigUrl());
+ try (Repository subModRepository = generator.getRepository()) {
+ StoredConfig submoduleConfig = subModRepository.getConfig();
+ assertEquals(url,
+ submoduleConfig.getString(
+ ConfigConstants.CONFIG_REMOTE_SECTION,
+ Constants.DEFAULT_REMOTE_NAME,
+ ConfigConstants.CONFIG_KEY_URL));
+ }
}
}
@@ -190,11 +191,11 @@ public class SubmoduleSyncTest extends RepositoryTestCase {
assertNotNull(subRepo);
addRepoToClose(subRepo);
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertNull(generator.getConfigUrl());
- assertEquals(current, generator.getModulesUrl());
-
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertNull(generator.getConfigUrl());
+ assertEquals(current, generator.getModulesUrl());
+ }
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION, path,
ConfigConstants.CONFIG_KEY_URL, "../sub.git");
modulesConfig.save();
@@ -207,16 +208,17 @@ public class SubmoduleSyncTest extends RepositoryTestCase {
assertEquals(path, module.getKey());
assertEquals("git://server/sub.git", module.getValue());
- generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- assertEquals("git://server/sub.git", generator.getConfigUrl());
- try (Repository subModRepository1 = generator.getRepository()) {
- StoredConfig submoduleConfig = subModRepository1.getConfig();
- assertEquals("git://server/sub.git",
- submoduleConfig.getString(
- ConfigConstants.CONFIG_REMOTE_SECTION,
- Constants.DEFAULT_REMOTE_NAME,
- ConfigConstants.CONFIG_KEY_URL));
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ assertEquals("git://server/sub.git", generator.getConfigUrl());
+ try (Repository subModRepository1 = generator.getRepository()) {
+ StoredConfig submoduleConfig = subModRepository1.getConfig();
+ assertEquals("git://server/sub.git",
+ submoduleConfig.getString(
+ ConfigConstants.CONFIG_REMOTE_SECTION,
+ Constants.DEFAULT_REMOTE_NAME,
+ ConfigConstants.CONFIG_KEY_URL));
+ }
}
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java
index bbce413ef3..6f358b47fd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleUpdateTest.java
@@ -119,11 +119,12 @@ public class SubmoduleUpdateTest extends RepositoryTestCase {
assertEquals(1, updated.size());
assertEquals(path, updated.iterator().next());
- SubmoduleWalk generator = SubmoduleWalk.forIndex(db);
- assertTrue(generator.next());
- try (Repository subRepo = generator.getRepository()) {
- assertNotNull(subRepo);
- assertEquals(commit, subRepo.resolve(Constants.HEAD));
+ try (SubmoduleWalk generator = SubmoduleWalk.forIndex(db)) {
+ assertTrue(generator.next());
+ try (Repository subRepo = generator.getRepository()) {
+ assertNotNull(subRepo);
+ assertEquals(commit, subRepo.resolve(Constants.HEAD));
+ }
}
}
@@ -181,10 +182,11 @@ public class SubmoduleUpdateTest extends RepositoryTestCase {
});
editor.commit();
- Repository subRepo = Git.init().setBare(false)
+ try (Repository subRepo = Git.init().setBare(false)
.setDirectory(new File(db.getWorkTree(), path)).call()
- .getRepository();
- assertNotNull(subRepo);
+ .getRepository()) {
+ assertNotNull(subRepo);
+ }
SubmoduleUpdateCommand command = new SubmoduleUpdateCommand(db);
Collection<String> updated = command.call();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
index ea1ace364e..0b6047f881 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java
@@ -98,10 +98,11 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
@Test
public void repositoryWithNoSubmodules() throws IOException {
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertFalse(gen.next());
- assertNull(gen.getPath());
- assertEquals(ObjectId.zeroId(), gen.getObjectId());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertFalse(gen.next());
+ assertNull(gen.getPath());
+ assertEquals(ObjectId.zeroId(), gen.getObjectId());
+ }
}
@Test
@@ -129,20 +130,21 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertTrue(gen.next());
- assertEquals(path, gen.getPath());
- assertEquals(id, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertNull(gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertNull(gen.getModulesUrl());
- assertNull(gen.getRepository());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertTrue(gen.next());
+ assertEquals(path, gen.getPath());
+ assertEquals(id, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertNull(gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertNull(gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
Status status = Git.wrap(db).status().call();
- assertTrue(!status.isClean());
- assertFalse(gen.next());
+ assertFalse(status.isClean());
}
@Test
@@ -178,24 +180,25 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertTrue(gen.next());
- assertEquals(path, gen.getPath());
- assertEquals(id, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertNull(gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertNull(gen.getModulesUrl());
- try (Repository subRepo = gen.getRepository()) {
- assertNotNull(subRepo);
- assertEquals(modulesGitDir.getAbsolutePath(),
- subRepo.getDirectory().getAbsolutePath());
- assertEquals(new File(db.getWorkTree(), path).getAbsolutePath(),
- subRepo.getWorkTree().getAbsolutePath());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertTrue(gen.next());
+ assertEquals(path, gen.getPath());
+ assertEquals(id, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertNull(gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertNull(gen.getModulesUrl());
+ try (Repository subRepo = gen.getRepository()) {
+ assertNotNull(subRepo);
+ assertEquals(modulesGitDir.getAbsolutePath(),
+ subRepo.getDirectory().getAbsolutePath());
+ assertEquals(new File(db.getWorkTree(), path).getAbsolutePath(),
+ subRepo.getWorkTree().getAbsolutePath());
+ }
+ assertFalse(gen.next());
}
- assertFalse(gen.next());
}
@Test
@@ -232,23 +235,24 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertTrue(gen.next());
- assertEquals(path, gen.getPath());
- assertEquals(id, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertNull(gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertNull(gen.getModulesUrl());
- try (Repository subRepo = gen.getRepository()) {
- assertNotNull(subRepo);
- assertEqualsFile(modulesGitDir, subRepo.getDirectory());
- assertEqualsFile(new File(db.getWorkTree(), path),
- subRepo.getWorkTree());
- subRepo.close();
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertTrue(gen.next());
+ assertEquals(path, gen.getPath());
+ assertEquals(id, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertNull(gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertNull(gen.getModulesUrl());
+ try (Repository subRepo = gen.getRepository()) {
+ assertNotNull(subRepo);
+ assertEqualsFile(modulesGitDir, subRepo.getDirectory());
+ assertEqualsFile(new File(db.getWorkTree(), path),
+ subRepo.getWorkTree());
+ subRepo.close();
+ assertFalse(gen.next());
+ }
}
}
@@ -270,18 +274,19 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertTrue(gen.next());
- assertEquals(path, gen.getPath());
- assertEquals(id, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertNull(gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertNull(gen.getModulesUrl());
- assertNull(gen.getRepository());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertTrue(gen.next());
+ assertEquals(path, gen.getPath());
+ assertEquals(id, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertNull(gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertNull(gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
}
@Test
@@ -312,12 +317,13 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- gen.setFilter(PathFilter.create(path1));
- assertTrue(gen.next());
- assertEquals(path1, gen.getPath());
- assertEquals(id1, gen.getObjectId());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ gen.setFilter(PathFilter.create(path1));
+ assertTrue(gen.next());
+ assertEquals(path1, gen.getPath());
+ assertEquals(id1, gen.getObjectId());
+ assertFalse(gen.next());
+ }
}
@Test
@@ -358,18 +364,19 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
});
editor.commit();
- SubmoduleWalk gen = SubmoduleWalk.forIndex(db);
- assertTrue(gen.next());
- assertEquals(path, gen.getPath());
- assertEquals(subId, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertEquals("sub", gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertEquals("git://example.com/sub", gen.getModulesUrl());
- assertNull(gen.getRepository());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forIndex(db)) {
+ assertTrue(gen.next());
+ assertEquals(path, gen.getPath());
+ assertEquals(subId, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertEquals("sub", gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertEquals("git://example.com/sub", gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
}
@Test
@@ -397,17 +404,19 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
})
.create());
- SubmoduleWalk gen = SubmoduleWalk.forPath(db, commit.getTree(), "sub");
- assertEquals(path, gen.getPath());
- assertEquals(subId, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertEquals("sub", gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertEquals("git://example.com/sub", gen.getModulesUrl());
- assertNull(gen.getRepository());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forPath(db, commit.getTree(),
+ "sub")) {
+ assertEquals(path, gen.getPath());
+ assertEquals(subId, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertEquals("sub", gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertEquals("git://example.com/sub", gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
}
@Test
@@ -437,17 +446,18 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
final CanonicalTreeParser p = new CanonicalTreeParser();
p.reset(testDb.getRevWalk().getObjectReader(), commit.getTree());
- SubmoduleWalk gen = SubmoduleWalk.forPath(db, p, "sub");
- assertEquals(path, gen.getPath());
- assertEquals(subId, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertEquals("sub", gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertEquals("git://example.com/sub", gen.getModulesUrl());
- assertNull(gen.getRepository());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forPath(db, p, "sub")) {
+ assertEquals(path, gen.getPath());
+ assertEquals(subId, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertEquals("sub", gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertEquals("git://example.com/sub", gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
}
@Test
@@ -477,16 +487,17 @@ public class SubmoduleWalkTest extends RepositoryTestCase {
final CanonicalTreeParser p = new CanonicalTreeParser();
p.reset(testDb.getRevWalk().getObjectReader(), commit.getTree());
- SubmoduleWalk gen = SubmoduleWalk.forPath(db, p, "sub");
- assertEquals(path, gen.getPath());
- assertEquals(subId, gen.getObjectId());
- assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
- assertNull(gen.getConfigUpdate());
- assertNull(gen.getConfigUrl());
- assertEquals("sub", gen.getModulesPath());
- assertNull(gen.getModulesUpdate());
- assertEquals("git://example.com/sub", gen.getModulesUrl());
- assertNull(gen.getRepository());
- assertFalse(gen.next());
+ try (SubmoduleWalk gen = SubmoduleWalk.forPath(db, p, "sub")) {
+ assertEquals(path, gen.getPath());
+ assertEquals(subId, gen.getObjectId());
+ assertEquals(new File(db.getWorkTree(), path), gen.getDirectory());
+ assertNull(gen.getConfigUpdate());
+ assertNull(gen.getConfigUrl());
+ assertEquals("sub", gen.getModulesPath());
+ assertNull(gen.getModulesUpdate());
+ assertEquals("git://example.com/sub", gen.getModulesUrl());
+ assertNull(gen.getRepository());
+ assertFalse(gen.next());
+ }
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/AtomicPushTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/AtomicPushTest.java
index c1e078d10d..d6c7a6199d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/AtomicPushTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/AtomicPushTest.java
@@ -55,10 +55,9 @@ import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
-import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
@@ -73,8 +72,8 @@ public class AtomicPushTest {
private Object ctx = new Object();
private InMemoryRepository server;
private InMemoryRepository client;
- private ObjectId obj1;
- private ObjectId obj2;
+ private ObjectId commit1;
+ private ObjectId commit2;
@Before
public void setUp() throws Exception {
@@ -92,10 +91,11 @@ public class AtomicPushTest {
});
uri = testProtocol.register(ctx, server);
- try (ObjectInserter ins = client.newObjectInserter()) {
- obj1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("test"));
- obj2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("file"));
- ins.flush();
+ try (TestRepository<?> clientRepo = new TestRepository<>(client)) {
+ commit1 = clientRepo.commit().noFiles().message("test commit 1")
+ .create();
+ commit2 = clientRepo.commit().noFiles().message("test commit 2")
+ .create();
}
}
@@ -149,13 +149,13 @@ public class AtomicPushTest {
List<RemoteRefUpdate> cmds = new ArrayList<>();
cmds.add(new RemoteRefUpdate(
null, null,
- obj1, "refs/heads/one",
+ commit1, "refs/heads/one",
true /* force update */,
null /* no local tracking ref */,
ObjectId.zeroId()));
cmds.add(new RemoteRefUpdate(
null, null,
- obj2, "refs/heads/two",
+ commit2, "refs/heads/two",
true /* force update */,
null /* no local tracking ref */,
ObjectId.zeroId()));
@@ -176,16 +176,16 @@ public class AtomicPushTest {
List<RemoteRefUpdate> cmds = new ArrayList<>();
cmds.add(new RemoteRefUpdate(
null, null,
- obj1, "refs/heads/one",
+ commit1, "refs/heads/one",
true /* force update */,
null /* no local tracking ref */,
ObjectId.zeroId()));
cmds.add(new RemoteRefUpdate(
null, null,
- obj2, "refs/heads/two",
+ commit2, "refs/heads/two",
true /* force update */,
null /* no local tracking ref */,
- obj1));
+ commit1));
return cmds;
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java
index ea15ebe7de..947ca97615 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java
@@ -133,16 +133,15 @@ public class HttpAuthTest {
@Override
public String getHeaderField(String name) {
- if (!headerFields.containsKey(name))
+ if (!headerFields.containsKey(name)) {
return null;
- else {
- int n = headerFields.get(name).size();
+ }
+ int n = headerFields.get(name).size();
- if (n > 0)
- return headerFields.get(name).get(n - 1);
- else
- return null;
+ if (n > 0) {
+ return headerFields.get(name).get(n - 1);
}
+ return null;
}
@Override
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
index fd1c3bf8b8..18946e0d50 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushOptionsTest.java
@@ -62,10 +62,9 @@ import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
import org.eclipse.jgit.junit.RepositoryTestCase;
-import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.junit.TestRepository;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
-import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -79,8 +78,8 @@ public class PushOptionsTest extends RepositoryTestCase {
private Object ctx = new Object();
private InMemoryRepository server;
private InMemoryRepository client;
- private ObjectId obj1;
- private ObjectId obj2;
+ private ObjectId commit1;
+ private ObjectId commit2;
private ReceivePack receivePack;
@Override
@@ -101,10 +100,11 @@ public class PushOptionsTest extends RepositoryTestCase {
uri = testProtocol.register(ctx, server);
- try (ObjectInserter ins = client.newObjectInserter()) {
- obj1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("test"));
- obj2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("file"));
- ins.flush();
+ try (TestRepository<?> clientRepo = new TestRepository<>(client)) {
+ commit1 = clientRepo.commit().noFiles().message("test commit 1")
+ .create();
+ commit2 = clientRepo.commit().noFiles().message("test commit 2")
+ .create();
}
}
@@ -121,12 +121,12 @@ public class PushOptionsTest extends RepositoryTestCase {
private List<RemoteRefUpdate> commands(boolean atomicSafe)
throws IOException {
List<RemoteRefUpdate> cmds = new ArrayList<>();
- cmds.add(new RemoteRefUpdate(null, null, obj1, "refs/heads/one",
+ cmds.add(new RemoteRefUpdate(null, null, commit1, "refs/heads/one",
true /* force update */, null /* no local tracking ref */,
ObjectId.zeroId()));
- cmds.add(new RemoteRefUpdate(null, null, obj2, "refs/heads/two",
+ cmds.add(new RemoteRefUpdate(null, null, commit2, "refs/heads/two",
true /* force update */, null /* no local tracking ref */,
- atomicSafe ? ObjectId.zeroId() : obj1));
+ atomicSafe ? ObjectId.zeroId() : commit1));
return cmds;
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitRequestValidatorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitRequestValidatorTest.java
new file mode 100644
index 0000000000..20b490b263
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitRequestValidatorTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019, Google LLC.
+ * 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.transport;
+
+import org.eclipse.jgit.transport.UploadPack.RequestValidator;
+
+/**
+ * Client may ask for any commit reachable from a reference advertised by
+ * the server.
+ */
+public class ReachableCommitRequestValidatorTest extends RequestValidatorTestCase {
+
+ @Override
+ protected RequestValidator createValidator() {
+ return new UploadPack.ReachableCommitRequestValidator();
+ }
+
+ @Override
+ protected boolean isReachableCommitValid() {
+ return true;
+ }
+
+ @Override
+ protected boolean isUnreachableCommitValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withBitmaps() {
+ return true;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withoutBitmaps() {
+ return false;
+ }
+
+ @Override
+ protected boolean isUnreachableBlobValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isAdvertisedTipValid() {
+ return true;
+ }
+
+ @Override
+ protected boolean isUnadvertisedTipCommitValid() {
+ return false;
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitTipRequestValidatorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitTipRequestValidatorTest.java
new file mode 100644
index 0000000000..5e5391dac7
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReachableCommitTipRequestValidatorTest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2019, Google LLC.
+ * 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.transport;
+
+import org.eclipse.jgit.transport.UploadPack.RequestValidator;
+
+/**
+ * Client may ask for any commit reachable from any reference, even if that
+ * reference wasn't advertised.
+ */
+public class ReachableCommitTipRequestValidatorTest
+ extends RequestValidatorTestCase {
+
+ @Override
+ protected RequestValidator createValidator() {
+ return new UploadPack.ReachableCommitTipRequestValidator();
+ }
+
+ @Override
+ protected boolean isReachableCommitValid() {
+ return true;
+ }
+
+ @Override
+ protected boolean isUnreachableCommitValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isAdvertisedTipValid() {
+ return true;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withBitmaps() {
+ return true;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withoutBitmaps() {
+ return false;
+ }
+
+ @Override
+ protected boolean isUnreachableBlobValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isUnadvertisedTipCommitValid() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java
new file mode 100644
index 0000000000..c1e7bcfcbe
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/RequestValidatorTestCase.java
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2019, Google LLC.
+ * 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.transport;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jgit.errors.PackProtocolException;
+import org.eclipse.jgit.errors.TransportException;
+import org.eclipse.jgit.internal.storage.dfs.DfsGarbageCollector;
+import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
+import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
+import org.eclipse.jgit.junit.TestRepository;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.revwalk.RevBlob;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.transport.UploadPack.RequestValidator;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public abstract class RequestValidatorTestCase {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private RevCommit reachableCommit;
+
+ private RevCommit tipAdvertisedCommit;
+
+ private RevCommit tipUnadvertisedCommit;
+
+ private RevCommit unreachableCommit;
+
+ private RevBlob reachableBlob;
+
+ private RevBlob unreachableBlob;
+
+ private InMemoryRepository repo;
+
+ protected abstract RequestValidator createValidator();
+
+ @Before
+ public void setUp() throws Exception {
+ repo = new InMemoryRepository(new DfsRepositoryDescription());
+ try (TestRepository<InMemoryRepository> git = new TestRepository<>(
+ repo)) {
+ reachableBlob = git.blob("foo");
+ reachableCommit = git
+ .commit(git.tree(git.file("foo", reachableBlob)));
+ tipAdvertisedCommit = git.commit(reachableCommit);
+ git.update("advertised", tipAdvertisedCommit);
+
+ tipUnadvertisedCommit = git.commit(reachableCommit);
+ git.update("unadvertised", tipUnadvertisedCommit);
+
+ unreachableBlob = git.blob("unreachableFoo");
+ unreachableCommit = git
+ .commit(git.tree(git.file("foo", unreachableBlob)));
+ }
+ }
+
+ /**
+ * @return true if a commit reachable from a visible tip (but not directly
+ * the tip) is valid
+ */
+ protected abstract boolean isReachableCommitValid();
+
+ /** @return true if a commit not reachable from any tip is valid */
+ protected abstract boolean isUnreachableCommitValid();
+
+ /**
+ * @return true if the commit directly pointed by an advertised ref is valid
+ */
+ protected abstract boolean isAdvertisedTipValid();
+
+ /**
+ * @return true if the object directly pointed by a non-advertised ref is
+ * valid
+ */
+ protected abstract boolean isUnadvertisedTipCommitValid();
+
+ // UploadPack doesn't allow to ask for blobs when there is no
+ // bitmap. Test both cases separately.
+ /**
+ * @return true if a reachable blob is valid (and the repo has bitmaps)
+ */
+ protected abstract boolean isReachableBlobValid_withBitmaps();
+
+ /**
+ * @return true if a reachable blob is valid (and the repo does NOT have
+ * bitmaps)
+ */
+ protected abstract boolean isReachableBlobValid_withoutBitmaps();
+
+ /**
+ * @return true if a blob unreachable from any tip is valid
+ */
+ protected abstract boolean isUnreachableBlobValid();
+
+ @Test
+ public void validateReachableCommitWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isReachableCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers
+ .containsString(
+ "want " + reachableCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(reachableCommit));
+ }
+
+ @Test
+ public void validateReachableCommitWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isReachableCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + reachableCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(reachableCommit));
+ }
+
+ @Test
+ public void validateAdvertisedTipWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isAdvertisedTipValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + tipAdvertisedCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(tipAdvertisedCommit));
+ }
+
+ @Test
+ public void validateAdvertisedTipWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isAdvertisedTipValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + tipAdvertisedCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(tipAdvertisedCommit));
+ }
+
+ @Test
+ public void validateUnadvertisedTipWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnadvertisedTipCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + tipUnadvertisedCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(tipUnadvertisedCommit));
+ }
+
+ @Test
+ public void validateUnadvertisedTipWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnadvertisedTipCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + tipUnadvertisedCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(tipUnadvertisedCommit));
+ }
+
+ @Test
+ public void validateUnreachableCommitWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnreachableCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + unreachableCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(unreachableCommit));
+ }
+
+ @Test
+ public void validateUnreachableCommitWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnreachableCommitValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + unreachableCommit.name() + " not valid"));
+
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(unreachableCommit));
+ }
+
+ @Test
+ public void validateReachableBlobWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isReachableBlobValid_withBitmaps()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + reachableBlob.name() + " not valid"));
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(reachableBlob));
+ }
+
+ @Test
+ public void validateReachableBlobWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isReachableBlobValid_withoutBitmaps()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + reachableBlob.name() + " not valid"));
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(reachableBlob));
+ }
+
+ @Test
+ public void validateUnreachableBlobWithBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnreachableBlobValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + unreachableBlob.name() + " not valid"));
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithBitmaps()),
+ Arrays.asList(unreachableBlob));
+ }
+
+ @Test
+ public void validateUnreachableBlobWithoutBitmaps()
+ throws PackProtocolException, IOException {
+ if (!isUnreachableBlobValid()) {
+ thrown.expect(TransportException.class);
+ thrown.expectMessage(Matchers.containsString(
+ "want " + unreachableBlob.name() + " not valid"));
+ }
+ createValidator().checkWants(getUploadPack(getRepoWithoutBitmaps()),
+ Arrays.asList(unreachableBlob));
+ }
+
+ private UploadPack getUploadPack(Repository repository) throws IOException {
+ UploadPack uploadPack = new UploadPack(repository);
+
+ Ref advertisedRef = repo.getRefDatabase().findRef("advertised");
+ Map<String, Ref> advertisedRefs = new HashMap<>();
+ advertisedRefs.put(advertisedRef.getName(), advertisedRef);
+
+ uploadPack.setAdvertisedRefs(advertisedRefs);
+ return uploadPack;
+ }
+
+ private Repository getRepoWithBitmaps() throws IOException {
+ new DfsGarbageCollector(repo).pack(null);
+ repo.scanForRepoChanges();
+ return repo;
+ }
+
+ private Repository getRepoWithoutBitmaps() {
+ return repo;
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TipRequestValidatorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TipRequestValidatorTest.java
new file mode 100644
index 0000000000..565d0e6e95
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TipRequestValidatorTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2019, Google LLC.
+ * 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.transport;
+
+import org.eclipse.jgit.transport.UploadPack.RequestValidator;
+
+/**
+ * Client may ask for objects that are the tip of any reference, even if not
+ * advertised.
+ */
+public class TipRequestValidatorTest extends RequestValidatorTestCase {
+
+ @Override
+ protected RequestValidator createValidator() {
+ return new UploadPack.TipRequestValidator();
+ }
+
+ @Override
+ protected boolean isReachableCommitValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isUnreachableCommitValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withBitmaps() {
+ return false;
+ }
+
+ @Override
+ protected boolean isReachableBlobValid_withoutBitmaps() {
+ return false;
+ }
+
+ @Override
+ protected boolean isUnreachableBlobValid() {
+ return false;
+ }
+
+ @Override
+ protected boolean isAdvertisedTipValid() {
+ return true;
+ }
+
+ @Override
+ protected boolean isUnadvertisedTipCommitValid() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java
new file mode 100644
index 0000000000..7122082d81
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackReachabilityTest.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2019, Google LLC.
+ * 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.transport;
+
+import static org.eclipse.jgit.lib.MoreAsserts.assertThrows;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collections;
+
+import org.eclipse.jgit.errors.TransportException;
+import org.eclipse.jgit.internal.storage.dfs.DfsGarbageCollector;
+import org.eclipse.jgit.internal.storage.dfs.DfsRepositoryDescription;
+import org.eclipse.jgit.internal.storage.dfs.InMemoryRepository;
+import org.eclipse.jgit.junit.TestRepository;
+import org.eclipse.jgit.lib.NullProgressMonitor;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.revwalk.RevBlob;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.transport.UploadPack.RequestPolicy;
+import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
+import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
+import org.eclipse.jgit.transport.resolver.UploadPackFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * Test combinations of:
+ * <ul>
+ * <li>Fetch a blob or a commit</li>
+ * <li>Fetched object is reachable or not</li>
+ * <li>With and without bitmaps</li>
+ * </ul>
+ */
+public class UploadPackReachabilityTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private URIish uri;
+
+ private TestProtocol<Object> testProtocol;
+
+ private Object ctx = new Object();
+
+ private InMemoryRepository server;
+
+ private InMemoryRepository client;
+
+ private TestRepository<InMemoryRepository> remote;
+
+ @Before
+ public void setUp() throws Exception {
+ server = newRepo("server");
+ client = newRepo("client");
+
+ remote = new TestRepository<>(server);
+ }
+
+ @After
+ public void tearDown() {
+ Transport.unregister(testProtocol);
+ }
+
+ @Test
+ public void testFetchUnreachableBlobWithBitmap() throws Exception {
+ RevBlob blob = remote.blob("foo");
+ remote.commit(remote.tree(remote.file("foo", blob)));
+ generateBitmaps(server);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ TransportException e = assertThrows(TransportException.class,
+ () -> tn.fetch(NullProgressMonitor.INSTANCE, Collections
+ .singletonList(new RefSpec(blob.name()))));
+ assertThat(e.getMessage(),
+ containsString("want " + blob.name() + " not valid"));
+ }
+ }
+
+ @Test
+ public void testFetchReachableBlobWithoutBitmap() throws Exception {
+ RevBlob blob = remote.blob("foo");
+ RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob)));
+ remote.update("master", commit);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ TransportException e = assertThrows(TransportException.class,
+ () -> tn.fetch(NullProgressMonitor.INSTANCE, Collections
+ .singletonList(new RefSpec(blob.name()))));
+ assertThat(e.getMessage(),
+ containsString(
+ "want " + blob.name() + " not valid"));
+ }
+ }
+
+ @Test
+ public void testFetchReachableBlobWithoutBitmapButFilterAllowed() throws Exception {
+ InMemoryRepository server2 = newRepo("server2");
+ try (TestRepository<InMemoryRepository> remote2 = new TestRepository<>(
+ server2)) {
+ RevBlob blob = remote2.blob("foo");
+ RevCommit commit = remote2.commit(remote2.tree(remote2.file("foo", blob)));
+ remote2.update("master", commit);
+
+ server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
+ true);
+
+ testProtocol = new TestProtocol<>((Object req, Repository db) -> {
+ UploadPack up = new UploadPack(db);
+ up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
+ return up;
+ }, null);
+ uri = testProtocol.register(ctx, server2);
+
+ assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server2")) {
+ tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(blob.name())));
+ assertTrue(client.getObjectDatabase().has(blob.toObjectId()));
+ }
+ }
+ }
+
+ @Test
+ public void testFetchUnreachableBlobWithoutBitmap() throws Exception {
+ RevBlob blob = remote.blob("foo");
+ remote.commit(remote.tree(remote.file("foo", blob)));
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ TransportException e = assertThrows(TransportException.class, () ->
+ tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(blob.name()))));
+ assertThat(e.getMessage(),
+ containsString("want " + blob.name() + " not valid"));
+ }
+ }
+
+ @Test
+ public void testFetchReachableBlobWithBitmap() throws Exception {
+ RevBlob blob = remote.blob("foo");
+ RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob)));
+ remote.update("master", commit);
+ generateBitmaps(server);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(blob.name())));
+ assertTrue(client.getObjectDatabase().has(blob.toObjectId()));
+ }
+ }
+
+ @Test
+ public void testFetchReachableCommitWithBitmap() throws Exception {
+ RevCommit commit = remote
+ .commit(remote.tree(remote.file("foo", remote.blob("foo"))));
+ remote.update("master", commit);
+ generateBitmaps(server);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(commit.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(commit.name())));
+ assertTrue(client.getObjectDatabase().has(commit.toObjectId()));
+ }
+ }
+
+ @Test
+ public void testFetchReachableCommitWithoutBitmap() throws Exception {
+ RevCommit commit = remote
+ .commit(remote.tree(remote.file("foo", remote.blob("foo"))));
+ remote.update("master", commit);
+ generateBitmaps(server);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(commit.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(commit.name())));
+ assertTrue(client.getObjectDatabase().has(commit.toObjectId()));
+ }
+ }
+
+ @Test
+ public void testFetchUnreachableCommitWithBitmap() throws Exception {
+ RevCommit commit = remote
+ .commit(remote.tree(remote.file("foo", remote.blob("foo"))));
+ generateBitmaps(server);
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(commit.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ TransportException e = assertThrows(TransportException.class,
+ () -> tn.fetch(NullProgressMonitor.INSTANCE,
+ Collections.singletonList(new RefSpec(commit.name()))));
+ assertThat(e.getMessage(),
+ containsString("want " + commit.name() + " not valid"));
+ }
+ }
+
+ @Test
+ public void testFetchUnreachableCommitWithoutBitmap() throws Exception {
+ RevCommit commit = remote
+ .commit(remote.tree(remote.file("foo", remote.blob("foo"))));
+
+ testProtocol = generateReachableCommitUploadPackProtocol();
+ uri = testProtocol.register(ctx, server);
+
+ assertFalse(client.getObjectDatabase().has(commit.toObjectId()));
+
+ try (Transport tn = testProtocol.open(uri, client, "server")) {
+ TransportException e = assertThrows(TransportException.class,
+ () -> tn.fetch(NullProgressMonitor.INSTANCE, Collections
+ .singletonList(new RefSpec(commit.name()))));
+ assertThat(e.getMessage(),
+ containsString("want " + commit.name() + " not valid"));
+ }
+ }
+
+ private static InMemoryRepository newRepo(String name) {
+ return new InMemoryRepository(new DfsRepositoryDescription(name));
+ }
+
+ private void generateBitmaps(InMemoryRepository repo) throws Exception {
+ new DfsGarbageCollector(repo).pack(null);
+ repo.scanForRepoChanges();
+ }
+
+ private static TestProtocol<Object> generateReachableCommitUploadPackProtocol() {
+ return new TestProtocol<>(new UploadPackFactory<Object>() {
+ @Override
+ public UploadPack create(Object req, Repository db)
+ throws ServiceNotEnabledException,
+ ServiceNotAuthorizedException {
+ UploadPack up = new UploadPack(db);
+ up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
+ return up;
+ }
+ }, null);
+ }
+}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
index 528a63f9c0..6d53555e9f 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
@@ -98,14 +98,6 @@ public class UploadPackTest {
repo.scanForRepoChanges();
}
- private static TestProtocol<Object> generateReachableCommitUploadPackProtocol() {
- return new TestProtocol<>((Object req, Repository db) -> {
- UploadPack up = new UploadPack(db);
- up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
- return up;
- }, null);
- }
-
@Test
public void testFetchParentOfShallowCommit() throws Exception {
RevCommit commit0 = remote.commit().message("0").create();
@@ -134,95 +126,6 @@ public class UploadPackTest {
}
@Test
- public void testFetchUnreachableBlobWithBitmap() throws Exception {
- RevBlob blob = remote.blob("foo");
- remote.commit(remote.tree(remote.file("foo", blob)));
- generateBitmaps(server);
-
- testProtocol = generateReachableCommitUploadPackProtocol();
- uri = testProtocol.register(ctx, server);
-
- assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
-
- try (Transport tn = testProtocol.open(uri, client, "server")) {
- TransportException e = assertThrows(TransportException.class,
- () -> tn.fetch(NullProgressMonitor.INSTANCE, Collections
- .singletonList(new RefSpec(blob.name()))));
- assertThat(e.getMessage(),
- containsString("want " + blob.name() + " not valid"));
- }
- }
-
- @Test
- public void testFetchReachableBlobWithBitmap() throws Exception {
- RevBlob blob = remote.blob("foo");
- RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob)));
- remote.update("master", commit);
- generateBitmaps(server);
-
- testProtocol = generateReachableCommitUploadPackProtocol();
- uri = testProtocol.register(ctx, server);
-
- assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
-
- try (Transport tn = testProtocol.open(uri, client, "server")) {
- tn.fetch(NullProgressMonitor.INSTANCE,
- Collections.singletonList(new RefSpec(blob.name())));
- assertTrue(client.getObjectDatabase().has(blob.toObjectId()));
- }
- }
-
- @Test
- public void testFetchReachableBlobWithoutBitmap() throws Exception {
- RevBlob blob = remote.blob("foo");
- RevCommit commit = remote.commit(remote.tree(remote.file("foo", blob)));
- remote.update("master", commit);
-
- testProtocol = generateReachableCommitUploadPackProtocol();
- uri = testProtocol.register(ctx, server);
-
- assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
-
- try (Transport tn = testProtocol.open(uri, client, "server")) {
- TransportException e = assertThrows(TransportException.class,
- () -> tn.fetch(NullProgressMonitor.INSTANCE, Collections
- .singletonList(new RefSpec(blob.name()))));
- assertThat(e.getMessage(),
- containsString(
- "want " + blob.name() + " not valid"));
- }
- }
-
- @Test
- public void testFetchReachableBlobWithoutBitmapButFilterAllowed() throws Exception {
- InMemoryRepository server2 = newRepo("server2");
- try (TestRepository<InMemoryRepository> remote2 = new TestRepository<>(
- server2)) {
- RevBlob blob = remote2.blob("foo");
- RevCommit commit = remote2.commit(remote2.tree(remote2.file("foo", blob)));
- remote2.update("master", commit);
-
- server2.getConfig().setBoolean("uploadpack", null, "allowfilter",
- true);
-
- testProtocol = new TestProtocol<>((Object req, Repository db) -> {
- UploadPack up = new UploadPack(db);
- up.setRequestPolicy(RequestPolicy.REACHABLE_COMMIT);
- return up;
- }, null);
- uri = testProtocol.register(ctx, server2);
-
- assertFalse(client.getObjectDatabase().has(blob.toObjectId()));
-
- try (Transport tn = testProtocol.open(uri, client, "server2")) {
- tn.fetch(NullProgressMonitor.INSTANCE,
- Collections.singletonList(new RefSpec(blob.name())));
- assertTrue(client.getObjectDatabase().has(blob.toObjectId()));
- }
- }
- }
-
- @Test
public void testFetchWithBlobNoneFilter() throws Exception {
InMemoryRepository server2 = newRepo("server2");
try (TestRepository<InMemoryRepository> remote2 = new TestRepository<>(
@@ -598,8 +501,11 @@ public class UploadPackTest {
}
@Test
- public void testV2CapabilitiesAllowSidebandAll() throws Exception {
- checkAdvertisedIfAllowed("uploadpack", "allowsidebandall", "sideband-all");
+ public void testV2CapabilitiesAdvertiseSidebandAll() throws Exception {
+ server.getConfig().setBoolean("uploadpack", null, "allowsidebandall",
+ true);
+ checkAdvertisedIfAllowed("uploadpack", "advertisesidebandall",
+ "sideband-all");
checkUnadvertisedIfUnallowed("sideband-all");
}
@@ -2112,12 +2018,12 @@ public class UploadPackTest {
ByteArrayInputStream recvStream = uploadPackV2(
"command=fetch\n",
- PacketLineIn.DELIM,
+ PacketLineIn.delimiter(),
"sideband-all\n",
"want " + fooChild.toObjectId().getName() + "\n",
"want " + barChild.toObjectId().getName() + "\n",
"have " + fooParent.toObjectId().getName() + "\n",
- PacketLineIn.END);
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
assertThat(pckIn.readString(), is("\001acknowledgments"));
@@ -2133,11 +2039,11 @@ public class UploadPackTest {
server.getConfig().setBoolean("uploadpack", null, "allowsidebandall", true);
ByteArrayInputStream recvStream = uploadPackV2("command=fetch\n",
- PacketLineIn.DELIM,
+ PacketLineIn.delimiter(),
"want " + commit.getName() + "\n",
"sideband-all\n",
"done\n",
- PacketLineIn.END);
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
String s;
@@ -2174,18 +2080,18 @@ public class UploadPackTest {
assertThat(protocolsSupported, hasItems("https"));
if (!protocolsSupported.contains("https"))
return null;
- return new PackInfo("myhash", "myuri");
+ return new PackInfo("myhash", "myuri", 100);
}
});
},
"command=fetch\n",
- PacketLineIn.DELIM,
+ PacketLineIn.delimiter(),
"want " + commit2.getName() + "\n",
"sideband-all\n",
"packfile-uris https\n",
"done\n",
- PacketLineIn.END);
+ PacketLineIn.end());
PacketLineIn pckIn = new PacketLineIn(recvStream);
String s;
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
index 4750d15b3d..d1d7a1d81d 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java
@@ -239,9 +239,8 @@ public class WalkEncryptionTest {
loadEnvVar(ENV_SECRET_KEY, SECRET_KEY, props);
loadEnvVar(ENV_BUCKET_NAME, TEST_BUCKET, props);
return props;
- } else {
- return null;
}
+ return null;
}
static Properties fromEnvFile() throws Exception {
@@ -250,12 +249,10 @@ public class WalkEncryptionTest {
props.load(new FileInputStream(ENV_CONFIG_FILE));
if (checkTestProps(props)) {
return props;
- } else {
- throw new Error("Environment config file is incomplete.");
}
- } else {
- return null;
+ throw new Error("Environment config file is incomplete.");
}
+ return null;
}
static Properties fromSysProps() {
@@ -266,9 +263,8 @@ public class WalkEncryptionTest {
loadSysProp(SYS_SECRET_KEY, SECRET_KEY, props);
loadSysProp(SYS_BUCKET_NAME, TEST_BUCKET, props);
return props;
- } else {
- return null;
}
+ return null;
}
static Properties fromSysFile() throws Exception {
@@ -277,12 +273,10 @@ public class WalkEncryptionTest {
props.load(new FileInputStream(SYS_CONFIG_FILE));
if (checkTestProps(props)) {
return props;
- } else {
- throw new Error("System props config file is incomplete.");
}
- } else {
- return null;
+ throw new Error("System props config file is incomplete.");
}
+ return null;
}
static Properties fromConfigFile(String path) throws Exception {
@@ -292,12 +286,10 @@ public class WalkEncryptionTest {
props.load(new FileInputStream(file));
if (checkTestProps(props)) {
return props;
- } else {
- throw new Error("Props config file is incomplete: " + path);
}
- } else {
- return null;
+ throw new Error("Props config file is incomplete: " + path);
}
+ return null;
}
/**
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java
index 58aa608ff5..4deb188784 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/EmptyTreeIteratorTest.java
@@ -65,12 +65,13 @@ public class EmptyTreeIteratorTest extends RepositoryTestCase {
@Test
public void testCreateSubtreeIterator() throws Exception {
final EmptyTreeIterator etp = new EmptyTreeIterator();
- final ObjectReader reader = db.newObjectReader();
- final AbstractTreeIterator sub = etp.createSubtreeIterator(reader);
- assertNotNull(sub);
- assertTrue(sub.first());
- assertTrue(sub.eof());
- assertTrue(sub instanceof EmptyTreeIterator);
+ try (ObjectReader reader = db.newObjectReader()) {
+ final AbstractTreeIterator sub = etp.createSubtreeIterator(reader);
+ assertNotNull(sub);
+ assertTrue(sub.first());
+ assertTrue(sub.eof());
+ assertTrue(sub instanceof EmptyTreeIterator);
+ }
}
@Test
@@ -121,8 +122,9 @@ public class EmptyTreeIteratorTest extends RepositoryTestCase {
called[0] = true;
}
};
- final ObjectReader reader = db.newObjectReader();
- parent.createSubtreeIterator(reader).stopWalk();
+ try (ObjectReader reader = db.newObjectReader()) {
+ parent.createSubtreeIterator(reader).stopWalk();
+ }
assertTrue(called[0]);
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
index a3ce4ae94f..ffa6e5d252 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
@@ -217,29 +217,29 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
assertFalse(top.eof());
assertEquals(FileMode.TREE.getBits(), top.mode);
- final ObjectReader reader = db.newObjectReader();
- final AbstractTreeIterator sub = top.createSubtreeIterator(reader);
- assertTrue(sub instanceof FileTreeIterator);
- final FileTreeIterator subfti = (FileTreeIterator) sub;
- assertTrue(sub.first());
- assertFalse(sub.eof());
- assertEquals(paths[2], nameOf(sub));
- assertEquals(paths[2].length(), subfti.getEntryLength());
- assertEquals(mtime[2], subfti.getEntryLastModifiedInstant());
-
- sub.next(1);
- assertTrue(sub.eof());
-
- top.next(1);
- assertFalse(top.first());
- assertFalse(top.eof());
- assertEquals(FileMode.REGULAR_FILE.getBits(), top.mode);
- assertEquals(paths[3], nameOf(top));
- assertEquals(paths[3].length(), top.getEntryLength());
- assertEquals(mtime[3], top.getEntryLastModifiedInstant());
-
- top.next(1);
- assertTrue(top.eof());
+ try (ObjectReader reader = db.newObjectReader()) {
+ final AbstractTreeIterator sub = top.createSubtreeIterator(reader);
+ assertTrue(sub instanceof FileTreeIterator);
+ final FileTreeIterator subfti = (FileTreeIterator) sub;
+ assertTrue(sub.first());
+ assertFalse(sub.eof());
+ assertEquals(paths[2], nameOf(sub));
+ assertEquals(paths[2].length(), subfti.getEntryLength());
+ assertEquals(mtime[2], subfti.getEntryLastModifiedInstant());
+
+ sub.next(1);
+ assertTrue(sub.eof());
+ top.next(1);
+ assertFalse(top.first());
+ assertFalse(top.eof());
+ assertEquals(FileMode.REGULAR_FILE.getBits(), top.mode);
+ assertEquals(paths[3], nameOf(top));
+ assertEquals(paths[3].length(), top.getEntryLength());
+ assertEquals(mtime[3], top.getEntryLastModifiedInstant());
+
+ top.next(1);
+ assertTrue(top.eof());
+ }
}
@Test
@@ -272,22 +272,23 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
git.add().addFilepattern("file").call();
}
DirCacheEntry dce = db.readDirCache().getEntry("file");
- TreeWalk tw = new TreeWalk(db);
- FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
- .getConfig().get(WorkingTreeOptions.KEY));
- tw.addTree(fti);
- DirCacheIterator dci = new DirCacheIterator(db.readDirCache());
- tw.addTree(dci);
- fti.setDirCacheIterator(tw, 1);
- while (tw.next() && !tw.getPathString().equals("file")) {
- //
- }
- assertEquals(MetadataDiff.EQUAL, fti.compareMetadata(dce));
- ObjectId fromRaw = ObjectId.fromRaw(fti.idBuffer(), fti.idOffset());
- assertEquals("6b584e8ece562ebffc15d38808cd6b98fc3d97ea",
- fromRaw.getName());
- try (ObjectReader objectReader = db.newObjectReader()) {
- assertFalse(fti.isModified(dce, false, objectReader));
+ try (TreeWalk tw = new TreeWalk(db)) {
+ FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(),
+ db.getConfig().get(WorkingTreeOptions.KEY));
+ tw.addTree(fti);
+ DirCacheIterator dci = new DirCacheIterator(db.readDirCache());
+ tw.addTree(dci);
+ fti.setDirCacheIterator(tw, 1);
+ while (tw.next() && !tw.getPathString().equals("file")) {
+ //
+ }
+ assertEquals(MetadataDiff.EQUAL, fti.compareMetadata(dce));
+ ObjectId fromRaw = ObjectId.fromRaw(fti.idBuffer(), fti.idOffset());
+ assertEquals("6b584e8ece562ebffc15d38808cd6b98fc3d97ea",
+ fromRaw.getName());
+ try (ObjectReader objectReader = db.newObjectReader()) {
+ assertFalse(fti.isModified(dce, false, objectReader));
+ }
}
}
@@ -624,9 +625,8 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
@Test
public void testCustomFileModeStrategy() throws Exception {
- Repository nestedRepo = createNestedRepo();
-
- try (Git git = new Git(nestedRepo)) {
+ try (Repository nestedRepo = createNestedRepo();
+ Git git = new Git(nestedRepo)) {
// validate that our custom strategy is honored
WorkingTreeIterator customIterator = new FileTreeIterator(
nestedRepo, NO_GITLINKS_STRATEGY);
@@ -641,9 +641,8 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
@Test
public void testCustomFileModeStrategyFromParentIterator() throws Exception {
- Repository nestedRepo = createNestedRepo();
-
- try (Git git = new Git(nestedRepo)) {
+ try (Repository nestedRepo = createNestedRepo();
+ Git git = new Git(nestedRepo)) {
FileTreeIterator customIterator = new FileTreeIterator(nestedRepo,
NO_GITLINKS_STRATEGY);
File r = new File(nestedRepo.getWorkTree(), "sub");
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
index 54c217276d..e6a5322374 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/NameConflictTreeWalkTest.java
@@ -84,16 +84,17 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertEquals(1, tree1.getEntryCount());
}
- final TreeWalk tw = new TreeWalk(db);
- tw.addTree(new DirCacheIterator(tree0));
- tw.addTree(new DirCacheIterator(tree1));
-
- assertModes("a", REGULAR_FILE, MISSING, tw);
- assertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
- assertModes("a", MISSING, TREE, tw);
- tw.enterSubtree();
- assertModes("a/b", MISSING, REGULAR_FILE, tw);
- assertModes("a0b", SYMLINK, MISSING, tw);
+ try (TreeWalk tw = new TreeWalk(db)) {
+ tw.addTree(new DirCacheIterator(tree0));
+ tw.addTree(new DirCacheIterator(tree1));
+
+ assertModes("a", REGULAR_FILE, MISSING, tw);
+ assertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
+ assertModes("a", MISSING, TREE, tw);
+ tw.enterSubtree();
+ assertModes("a/b", MISSING, REGULAR_FILE, tw);
+ assertModes("a0b", SYMLINK, MISSING, tw);
+ }
}
@Test
@@ -115,20 +116,21 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertEquals(1, tree1.getEntryCount());
}
- final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.addTree(new DirCacheIterator(tree0));
- tw.addTree(new DirCacheIterator(tree1));
-
- assertModes("a", REGULAR_FILE, TREE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- assertTrue(tw.isSubtree());
- tw.enterSubtree();
- assertModes("a/b", MISSING, REGULAR_FILE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- assertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
- assertFalse(tw.isDirectoryFileConflict());
- assertModes("a0b", SYMLINK, MISSING, tw);
- assertFalse(tw.isDirectoryFileConflict());
+ try (NameConflictTreeWalk tw = new NameConflictTreeWalk(db)) {
+ tw.addTree(new DirCacheIterator(tree0));
+ tw.addTree(new DirCacheIterator(tree1));
+
+ assertModes("a", REGULAR_FILE, TREE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ assertTrue(tw.isSubtree());
+ tw.enterSubtree();
+ assertModes("a/b", MISSING, REGULAR_FILE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ assertModes("a.b", EXECUTABLE_FILE, MISSING, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ assertModes("a0b", SYMLINK, MISSING, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ }
}
@Test
@@ -151,20 +153,21 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertEquals(2, tree1.getEntryCount());
}
- final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.addTree(new DirCacheIterator(tree0));
- tw.addTree(new DirCacheIterator(tree1));
-
- assertModes("a", REGULAR_FILE, TREE, tw);
- assertTrue(tw.isSubtree());
- assertTrue(tw.isDirectoryFileConflict());
- tw.enterSubtree();
- assertModes("a/b", MISSING, REGULAR_FILE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- assertModes("a.b", EXECUTABLE_FILE, EXECUTABLE_FILE, tw);
- assertFalse(tw.isDirectoryFileConflict());
- assertModes("a0b", SYMLINK, MISSING, tw);
- assertFalse(tw.isDirectoryFileConflict());
+ try (NameConflictTreeWalk tw = new NameConflictTreeWalk(db)) {
+ tw.addTree(new DirCacheIterator(tree0));
+ tw.addTree(new DirCacheIterator(tree1));
+
+ assertModes("a", REGULAR_FILE, TREE, tw);
+ assertTrue(tw.isSubtree());
+ assertTrue(tw.isDirectoryFileConflict());
+ tw.enterSubtree();
+ assertModes("a/b", MISSING, REGULAR_FILE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ assertModes("a.b", EXECUTABLE_FILE, EXECUTABLE_FILE, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ assertModes("a0b", SYMLINK, MISSING, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ }
}
@Test
@@ -187,20 +190,21 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertEquals(3, tree1.getEntryCount());
}
- final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.addTree(new DirCacheIterator(tree0));
- tw.addTree(new DirCacheIterator(tree1));
-
- assertModes("a", REGULAR_FILE, TREE, tw);
- assertTrue(tw.isSubtree());
- assertTrue(tw.isDirectoryFileConflict());
- tw.enterSubtree();
- assertModes("a/b", MISSING, REGULAR_FILE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- assertModes("a.b", MISSING, EXECUTABLE_FILE, tw);
- assertFalse(tw.isDirectoryFileConflict());
- assertModes("a0b", SYMLINK, SYMLINK, tw);
- assertFalse(tw.isDirectoryFileConflict());
+ try (NameConflictTreeWalk tw = new NameConflictTreeWalk(db)) {
+ tw.addTree(new DirCacheIterator(tree0));
+ tw.addTree(new DirCacheIterator(tree1));
+
+ assertModes("a", REGULAR_FILE, TREE, tw);
+ assertTrue(tw.isSubtree());
+ assertTrue(tw.isDirectoryFileConflict());
+ tw.enterSubtree();
+ assertModes("a/b", MISSING, REGULAR_FILE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ assertModes("a.b", MISSING, EXECUTABLE_FILE, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ assertModes("a0b", SYMLINK, SYMLINK, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ }
}
@Test
@@ -224,26 +228,27 @@ public class NameConflictTreeWalkTest extends RepositoryTestCase {
assertEquals(4, tree1.getEntryCount());
}
- final NameConflictTreeWalk tw = new NameConflictTreeWalk(db);
- tw.addTree(new DirCacheIterator(tree0));
- tw.addTree(new DirCacheIterator(tree1));
-
- assertModes("0", REGULAR_FILE, REGULAR_FILE, tw);
- assertFalse(tw.isDirectoryFileConflict());
- assertModes("a", REGULAR_FILE, TREE, tw);
- assertTrue(tw.isSubtree());
- assertTrue(tw.isDirectoryFileConflict());
- tw.enterSubtree();
- assertModes("a/b", MISSING, REGULAR_FILE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- assertModes("a/c", MISSING, TREE, tw);
- assertTrue(tw.isDirectoryFileConflict());
- tw.enterSubtree();
- assertModes("a/c/e", MISSING, REGULAR_FILE, tw);
- assertTrue(tw.isDirectoryFileConflict());
-
- assertModes("a.b", MISSING, REGULAR_FILE, tw);
- assertFalse(tw.isDirectoryFileConflict());
+ try (NameConflictTreeWalk tw = new NameConflictTreeWalk(db)) {
+ tw.addTree(new DirCacheIterator(tree0));
+ tw.addTree(new DirCacheIterator(tree1));
+
+ assertModes("0", REGULAR_FILE, REGULAR_FILE, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ assertModes("a", REGULAR_FILE, TREE, tw);
+ assertTrue(tw.isSubtree());
+ assertTrue(tw.isDirectoryFileConflict());
+ tw.enterSubtree();
+ assertModes("a/b", MISSING, REGULAR_FILE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ assertModes("a/c", MISSING, TREE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+ tw.enterSubtree();
+ assertModes("a/c/e", MISSING, REGULAR_FILE, tw);
+ assertTrue(tw.isDirectoryFileConflict());
+
+ assertModes("a.b", MISSING, REGULAR_FILE, tw);
+ assertFalse(tw.isDirectoryFileConflict());
+ }
}
private static void assertModes(final String path, final FileMode mode0,
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
index 2f797e361a..964ffcaa83 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java
@@ -101,13 +101,14 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteAll();
writeFileWithFolderName();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertTrue(treeWalk.next());
- assertEquals("folder", treeWalk.getPathString());
- assertTrue(treeWalk.next());
- assertEquals("folder/file", treeWalk.getPathString());
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertTrue(treeWalk.next());
+ assertEquals("folder", treeWalk.getPathString());
+ assertTrue(treeWalk.next());
+ assertEquals("folder/file", treeWalk.getPathString());
+ assertFalse(treeWalk.next());
+ }
}
@Test
@@ -115,24 +116,26 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteAll();
writeFileWithFolderName();
- TreeWalk treeWalk = createNonRecursiveTreeWalk(commit);
-
- assertTrue(treeWalk.next());
- assertEquals("folder", treeWalk.getPathString());
- assertTrue(treeWalk.next());
- assertEquals("folder", treeWalk.getPathString());
- assertTrue(treeWalk.isSubtree());
- treeWalk.enterSubtree();
- assertTrue(treeWalk.next());
- assertEquals("folder/file", treeWalk.getPathString());
- assertFalse(treeWalk.next());
+
+ try (TreeWalk treeWalk = createNonRecursiveTreeWalk(commit)) {
+ assertTrue(treeWalk.next());
+ assertEquals("folder", treeWalk.getPathString());
+ assertTrue(treeWalk.next());
+ assertEquals("folder", treeWalk.getPathString());
+ assertTrue(treeWalk.isSubtree());
+ treeWalk.enterSubtree();
+ assertTrue(treeWalk.next());
+ assertEquals("folder/file", treeWalk.getPathString());
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileCommitted() throws Exception {
RevCommit commit = writeFileAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
@@ -153,89 +156,100 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
"<<<<<<< HEAD\nside\n=======\nmaster\n>>>>>>> master\n");
writeTrashFile(FILE, "master");
- TreeWalk treeWalk = createTreeWalk(side);
- int count = 0;
- while (treeWalk.next())
- count++;
- assertEquals(2, count);
+ try (TreeWalk treeWalk = createTreeWalk(side)) {
+ int count = 0;
+ while (treeWalk.next())
+ count++;
+ assertEquals(2, count);
+ }
}
@Test
public void testFileInFolderCommitted() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testEmptyFolderCommitted() throws Exception {
RevCommit commit = createEmptyFolderAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileCommittedChangedNotModified() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFile();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileInFolderCommittedChangedNotModified() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolder();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileCommittedModified() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileModified();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
public void testFileInFolderCommittedModified() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderModified();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
public void testFileCommittedDeleted() throws Exception {
RevCommit commit = writeFileAndCommit();
deleteFile();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
public void testFileInFolderCommittedDeleted() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
deleteFileInFolder();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
public void testFileInFolderCommittedAllDeleted() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
deleteAll();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
public void testEmptyFolderCommittedDeleted() throws Exception {
RevCommit commit = createEmptyFolderAndCommit();
deleteFolder();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
@@ -243,8 +257,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileModifiedAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
@@ -252,8 +267,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderModifiedAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -261,8 +277,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = writeFileAndCommit();
deleteFileAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
@@ -270,8 +287,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
deleteFileInFolderAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -279,8 +297,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
deleteAllAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -288,96 +307,108 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
throws Exception {
RevCommit commit = createEmptyFolderAndCommit();
deleteFolderAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileUntracked() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileUntracked();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, UNTRACKED_FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, UNTRACKED_FILE);
+ }
}
@Test
public void testFileInFolderUntracked() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderUntracked();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, UNTRACKED_FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, UNTRACKED_FILE_IN_FOLDER);
+ }
}
@Test
public void testEmptyFolderUntracked() throws Exception {
RevCommit commit = createEmptyFolderAndCommit();
createEmptyFolderUntracked();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileIgnored() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileInFolderIgnored() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileInFolderAllIgnored() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderAllIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testEmptyFolderIgnored() throws Exception {
RevCommit commit = createEmptyFolderAndCommit();
createEmptyFolderIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileIgnoredNotHonored() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileIgnored();
- TreeWalk treeWalk = createTreeWalkDishonorIgnores(commit);
- assertPaths(treeWalk, IGNORED_FILE, GITIGNORE);
+ try (TreeWalk treeWalk = createTreeWalkDishonorIgnores(commit)) {
+ assertPaths(treeWalk, IGNORED_FILE, GITIGNORE);
+ }
}
@Test
public void testFileCommittedModifiedIgnored() throws Exception {
RevCommit commit = writeFileAndCommit();
writeFileModifiedIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
public void testFileInFolderCommittedModifiedIgnored() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderModifiedIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
public void testFileInFolderCommittedModifiedAllIgnored() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
writeFileInFolderModifiedAllIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -386,8 +417,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileAndCommit();
deleteFileAndCommit();
rewriteFileIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE);
+ }
}
@Test
@@ -396,8 +428,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteFileInFolderAndCommit();
rewriteFileInFolderIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -406,8 +439,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteAllAndCommit();
rewriteFileInFolderAllIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FILE_IN_FOLDER);
+ }
}
@Test
@@ -416,15 +450,17 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = createEmptyFolderAndCommit();
deleteFolderAndCommit();
recreateEmptyFolderIgnored();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertFalse(treeWalk.next());
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertFalse(treeWalk.next());
+ }
}
@Test
public void testFileInFolderCommittedNonRecursive() throws Exception {
RevCommit commit = writeFileInFolderAndCommit();
- TreeWalk treeWalk = createNonRecursiveTreeWalk(commit);
- assertPaths(treeWalk, FOLDER);
+ try (TreeWalk treeWalk = createNonRecursiveTreeWalk(commit)) {
+ assertPaths(treeWalk, FOLDER);
+ }
}
@Test
@@ -432,8 +468,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteAll();
writeFileWithFolderName();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FOLDER, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FOLDER, FILE_IN_FOLDER);
+ }
}
@Test
@@ -442,8 +479,9 @@ public class IndexDiffFilterTest extends RepositoryTestCase {
RevCommit commit = writeFileInFolderAndCommit();
deleteAll();
writeFileWithFolderNameAndCommit();
- TreeWalk treeWalk = createTreeWalk(commit);
- assertPaths(treeWalk, FOLDER, FILE_IN_FOLDER);
+ try (TreeWalk treeWalk = createTreeWalk(commit)) {
+ assertPaths(treeWalk, FOLDER, FILE_IN_FOLDER);
+ }
}
private void writeFile() throws Exception {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HookTest.java
index e5fcbf9d7c..70a2dbbfe8 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HookTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HookTest.java
@@ -58,6 +58,8 @@ import org.eclipse.jgit.hooks.PostCommitHook;
import org.eclipse.jgit.hooks.PreCommitHook;
import org.eclipse.jgit.junit.JGitTestUtil;
import org.eclipse.jgit.junit.RepositoryTestCase;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Assume;
import org.junit.Test;
@@ -221,6 +223,75 @@ public class HookTest extends RepositoryTestCase {
}
@Test
+ public void testRunHookHooksPathRelative() throws Exception {
+ assumeSupportedPlatform();
+
+ writeHookFile(PreCommitHook.NAME,
+ "#!/bin/sh\necho \"Wrong hook $1 $2\"\nread INPUT\necho $INPUT\n"
+ + "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\"");
+ writeHookFile("../../" + PreCommitHook.NAME,
+ "#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\n"
+ + "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\"");
+ StoredConfig cfg = db.getConfig();
+ cfg.load();
+ cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_HOOKS_PATH, ".");
+ cfg.save();
+ try (ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream()) {
+ ProcessResult res = FS.DETECTED.runHookIfPresent(db,
+ PreCommitHook.NAME, new String[] { "arg1", "arg2" },
+ new PrintStream(out), new PrintStream(err), "stdin");
+
+ assertEquals("unexpected hook output",
+ "test arg1 arg2\nstdin\n"
+ + db.getDirectory().getAbsolutePath() + '\n'
+ + db.getWorkTree().getAbsolutePath() + '\n',
+ out.toString("UTF-8"));
+ assertEquals("unexpected output on stderr stream", "stderr\n",
+ err.toString("UTF-8"));
+ assertEquals("unexpected exit code", 0, res.getExitCode());
+ assertEquals("unexpected process status", ProcessResult.Status.OK,
+ res.getStatus());
+ }
+ }
+
+ @Test
+ public void testRunHookHooksPathAbsolute() throws Exception {
+ assumeSupportedPlatform();
+
+ writeHookFile(PreCommitHook.NAME,
+ "#!/bin/sh\necho \"Wrong hook $1 $2\"\nread INPUT\necho $INPUT\n"
+ + "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\"");
+ writeHookFile("../../" + PreCommitHook.NAME,
+ "#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\n"
+ + "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\"");
+ StoredConfig cfg = db.getConfig();
+ cfg.load();
+ cfg.setString(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_HOOKS_PATH,
+ db.getWorkTree().getAbsolutePath());
+ cfg.save();
+ try (ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream()) {
+ ProcessResult res = FS.DETECTED.runHookIfPresent(db,
+ PreCommitHook.NAME, new String[] { "arg1", "arg2" },
+ new PrintStream(out), new PrintStream(err), "stdin");
+
+ assertEquals("unexpected hook output",
+ "test arg1 arg2\nstdin\n"
+ + db.getDirectory().getAbsolutePath() + '\n'
+ + db.getWorkTree().getAbsolutePath() + '\n',
+ out.toString("UTF-8"));
+ assertEquals("unexpected output on stderr stream", "stderr\n",
+ err.toString("UTF-8"));
+ assertEquals("unexpected exit code", 0, res.getExitCode());
+ assertEquals("unexpected process status", ProcessResult.Status.OK,
+ res.getStatus());
+ }
+ }
+
+ @Test
public void testFailedPreCommitHookBlockCommit() throws Exception {
assumeSupportedPlatform();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HttpSupportTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HttpSupportTest.java
new file mode 100644
index 0000000000..cbe4eb2eb0
--- /dev/null
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/HttpSupportTest.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019, Thomas Wolf <thomas.wolf@paranor.ch> and others
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Distribution License v. 1.0 which is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+package org.eclipse.jgit.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.SocketAddress;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import org.junit.Test;
+
+public class HttpSupportTest {
+
+ private static class TestProxySelector extends ProxySelector {
+
+ private static final Proxy DUMMY = new Proxy(Proxy.Type.HTTP,
+ InetSocketAddress.createUnresolved("localhost", 0));
+
+ @Override
+ public List<Proxy> select(URI uri) {
+ if ("http".equals(uri.getScheme())
+ && "somehost".equals(uri.getHost())) {
+ return Collections.singletonList(DUMMY);
+ }
+ return Collections.singletonList(Proxy.NO_PROXY);
+ }
+
+ @Override
+ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
+ // Empty
+ }
+ }
+
+ @Test
+ public void testMalformedUri() throws Exception {
+ // Valid URL, but backslash is not allowed in a URI in the userinfo part
+ // per RFC 3986: https://tools.ietf.org/html/rfc3986#section-3.2.1 .
+ // Test that conversion to URI to call the ProxySelector does not throw
+ // an exception.
+ Proxy proxy = HttpSupport.proxyFor(new TestProxySelector(), new URL(
+ "http://infor\\c.jones@somehost/somewhere/someproject.git"));
+ assertNotNull(proxy);
+ assertEquals(Proxy.Type.HTTP, proxy.type());
+ }
+
+ @Test
+ public void testCorrectUri() throws Exception {
+ // Backslash escaped as %5C is correct.
+ Proxy proxy = HttpSupport.proxyFor(new TestProxySelector(), new URL(
+ "http://infor%5Cc.jones@somehost/somewhere/someproject.git"));
+ assertNotNull(proxy);
+ assertEquals(Proxy.Type.HTTP, proxy.type());
+ }
+}
diff --git a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
index 525ac67142..9fd92b1098 100644
--- a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
index b143d51720..38f63f99b6 100644
--- a/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit.ui/META-INF/MANIFEST.MF
@@ -4,14 +4,14 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit.ui
Bundle-SymbolicName: org.eclipse.jgit.ui
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.jgit.awtui;version="5.5.2"
-Import-Package: org.eclipse.jgit.errors;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.lib;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.nls;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revplot;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.revwalk;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.transport;version="[5.5.2,5.6.0)",
- org.eclipse.jgit.util;version="[5.5.2,5.6.0)"
+Export-Package: org.eclipse.jgit.awtui;version="5.6.0"
+Import-Package: org.eclipse.jgit.errors;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.lib;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.nls;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revplot;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.revwalk;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.transport;version="[5.6.0,5.7.0)",
+ org.eclipse.jgit.util;version="[5.6.0,5.7.0)"
diff --git a/org.eclipse.jgit.ui/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit.ui/META-INF/SOURCE-MANIFEST.MF
index 5e75347f77..c19a634419 100644
--- a/org.eclipse.jgit.ui/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit.ui/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit.ui - Sources
Bundle-SymbolicName: org.eclipse.jgit.ui.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit.ui;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit.ui;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit.ui/pom.xml b/org.eclipse.jgit.ui/pom.xml
index fe7af76d8e..7d6c77d491 100644
--- a/org.eclipse.jgit.ui/pom.xml
+++ b/org.eclipse.jgit.ui/pom.xml
@@ -52,7 +52,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit.ui</artifactId>
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index f50ea9a6d5..f037ba2f3a 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -1,166 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jgit" version="2">
- <resource path="src/org/eclipse/jgit/dircache/DirCacheEntry.java" type="org.eclipse.jgit.dircache.DirCacheEntry">
- <filter id="1142947843">
+ <resource path="src/org/eclipse/jgit/storage/pack/PackStatistics.java" type="org.eclipse.jgit.storage.pack.PackStatistics$Accumulator">
+ <filter id="336658481">
<message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getLastModifiedInstant()"/>
+ <message_argument value="org.eclipse.jgit.storage.pack.PackStatistics.Accumulator"/>
+ <message_argument value="offloadedPackfileSize"/>
</message_arguments>
</filter>
- <filter id="1142947843">
+ <filter id="336658481">
<message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="mightBeRacilyClean(Instant)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="setLastModified(Instant)"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/lib/AnyObjectId.java" type="org.eclipse.jgit.lib.AnyObjectId">
- <filter id="1141899266">
- <message_arguments>
- <message_argument value="5.4"/>
- <message_argument value="5.5"/>
- <message_argument value="isEqual(AnyObjectId, AnyObjectId)"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/lib/ConfigConstants.java" type="org.eclipse.jgit.lib.ConfigConstants">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="CONFIG_FILESYSTEM_SECTION"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="CONFIG_KEY_MIN_RACY_THRESHOLD"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="CONFIG_KEY_TIMESTAMP_RESOLUTION"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java" type="org.eclipse.jgit.treewalk.WorkingTreeIterator">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getEntryLastModifiedInstant()"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java" type="org.eclipse.jgit.treewalk.WorkingTreeIterator$Entry">
- <filter id="336695337">
- <message_arguments>
- <message_argument value="org.eclipse.jgit.treewalk.WorkingTreeIterator.Entry"/>
- <message_argument value="getLastModifiedInstant()"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getLastModifiedInstant()"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/FS.java" type="org.eclipse.jgit.util.FS">
- <filter id="338792546">
- <message_arguments>
- <message_argument value="org.eclipse.jgit.util.FS"/>
- <message_argument value="getFsTimerResolution(Path)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getFileStoreAttributes(Path)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="lastModifiedInstant(File)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="lastModifiedInstant(Path)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="setAsyncFileStoreAttributes(boolean)"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="setLastModified(Path, Instant)"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/FS.java" type="org.eclipse.jgit.util.FS$Attributes">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getLastModifiedInstant()"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/FS.java" type="org.eclipse.jgit.util.FS$FileStoreAttributes">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="FileStoreAttributes"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/References.java" type="org.eclipse.jgit.util.References">
- <filter id="1108344834">
- <message_arguments>
- <message_argument value="5.4"/>
- <message_argument value="5.5"/>
- <message_argument value="org.eclipse.jgit.util.References"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/SimpleLruCache.java" type="org.eclipse.jgit.util.SimpleLruCache">
- <filter id="1109393411">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="org.eclipse.jgit.util.SimpleLruCache"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/Stats.java" type="org.eclipse.jgit.util.Stats">
- <filter id="1109393411">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="org.eclipse.jgit.util.Stats"/>
- </message_arguments>
- </filter>
- </resource>
- <resource path="src/org/eclipse/jgit/util/SystemReader.java" type="org.eclipse.jgit.util.SystemReader">
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getSystemConfig()"/>
- </message_arguments>
- </filter>
- <filter id="1142947843">
- <message_arguments>
- <message_argument value="5.1.9"/>
- <message_argument value="getUserConfig()"/>
+ <message_argument value="org.eclipse.jgit.storage.pack.PackStatistics.Accumulator"/>
+ <message_argument value="offloadedPackfiles"/>
</message_arguments>
</filter>
</resource>
diff --git a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
index ef6f5e732f..bc7ba1e50e 100644
--- a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs
@@ -92,7 +92,7 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
diff --git a/org.eclipse.jgit/META-INF/MANIFEST.MF b/org.eclipse.jgit/META-INF/MANIFEST.MF
index 69cdf30459..ab0f1a2c09 100644
--- a/org.eclipse.jgit/META-INF/MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/MANIFEST.MF
@@ -3,12 +3,12 @@ Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Automatic-Module-Name: org.eclipse.jgit
Bundle-SymbolicName: org.eclipse.jgit
-Bundle-Version: 5.5.2.qualifier
+Bundle-Version: 5.6.0.qualifier
Bundle-Localization: plugin
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.jgit.annotations;version="5.5.2",
- org.eclipse.jgit.api;version="5.5.2";
+Export-Package: org.eclipse.jgit.annotations;version="5.6.0",
+ org.eclipse.jgit.api;version="5.6.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
@@ -22,53 +22,53 @@ Export-Package: org.eclipse.jgit.annotations;version="5.5.2",
org.eclipse.jgit.submodule,
org.eclipse.jgit.transport,
org.eclipse.jgit.merge",
- org.eclipse.jgit.api.errors;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
- org.eclipse.jgit.attributes;version="5.5.2",
- org.eclipse.jgit.blame;version="5.5.2";
+ org.eclipse.jgit.api.errors;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.errors",
+ org.eclipse.jgit.attributes;version="5.6.0",
+ org.eclipse.jgit.blame;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff",
- org.eclipse.jgit.diff;version="5.5.2";
+ org.eclipse.jgit.diff;version="5.6.0";
uses:="org.eclipse.jgit.patch,
org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util",
- org.eclipse.jgit.dircache;version="5.5.2";
+ org.eclipse.jgit.dircache;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.util,
org.eclipse.jgit.events,
org.eclipse.jgit.attributes",
- org.eclipse.jgit.errors;version="5.5.2";
+ org.eclipse.jgit.errors;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.internal.storage.pack,
org.eclipse.jgit.transport,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.events;version="5.5.2";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.fnmatch;version="5.5.2",
- org.eclipse.jgit.gitrepo;version="5.5.2";
+ org.eclipse.jgit.events;version="5.6.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.fnmatch;version="5.6.0",
+ org.eclipse.jgit.gitrepo;version="5.6.0";
uses:="org.eclipse.jgit.api,
org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.xml.sax.helpers,
org.xml.sax",
- org.eclipse.jgit.gitrepo.internal;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.hooks;version="5.5.2";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.ignore;version="5.5.2",
- org.eclipse.jgit.ignore.internal;version="5.5.2";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal;version="5.5.2";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
- org.eclipse.jgit.internal.fsck;version="5.5.2";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal.ketch;version="5.5.2";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.revwalk;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.internal.storage.dfs;version="5.5.2";
+ org.eclipse.jgit.gitrepo.internal;version="5.6.0";x-internal:=true,
+ org.eclipse.jgit.hooks;version="5.6.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.ignore;version="5.6.0",
+ org.eclipse.jgit.ignore.internal;version="5.6.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal;version="5.6.0";x-friends:="org.eclipse.jgit.test,org.eclipse.jgit.http.test",
+ org.eclipse.jgit.internal.fsck;version="5.6.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal.ketch;version="5.6.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.revwalk;version="5.6.0";x-internal:=true,
+ org.eclipse.jgit.internal.storage.dfs;version="5.6.0";
x-friends:="org.eclipse.jgit.test,
org.eclipse.jgit.http.server,
org.eclipse.jgit.http.test,
org.eclipse.jgit.lfs.test",
- org.eclipse.jgit.internal.storage.file;version="5.5.2";
+ org.eclipse.jgit.internal.storage.file;version="5.6.0";
x-friends:="org.eclipse.jgit.test,
org.eclipse.jgit.junit,
org.eclipse.jgit.junit.http,
@@ -77,19 +77,19 @@ Export-Package: org.eclipse.jgit.annotations;version="5.5.2",
org.eclipse.jgit.pgm,
org.eclipse.jgit.pgm.test,
org.eclipse.jgit.ssh.apache",
- org.eclipse.jgit.internal.storage.io;version="5.5.2";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.pack;version="5.5.2";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.reftable;version="5.5.2";
+ org.eclipse.jgit.internal.storage.io;version="5.6.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.pack;version="5.6.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.storage.reftable;version="5.6.0";
x-friends:="org.eclipse.jgit.http.test,
org.eclipse.jgit.junit,
org.eclipse.jgit.test,
org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.storage.reftree;version="5.5.2";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
- org.eclipse.jgit.internal.submodule;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.internal.transport.http;version="5.5.2";x-friends:="org.eclipse.jgit.test",
- org.eclipse.jgit.internal.transport.parser;version="5.5.2";x-friends:="org.eclipse.jgit.http.server,org.eclipse.jgit.test",
- org.eclipse.jgit.internal.transport.ssh;version="5.5.2";x-friends:="org.eclipse.jgit.ssh.apache",
- org.eclipse.jgit.lib;version="5.5.2";
+ org.eclipse.jgit.internal.storage.reftree;version="5.6.0";x-friends:="org.eclipse.jgit.junit,org.eclipse.jgit.test,org.eclipse.jgit.pgm",
+ org.eclipse.jgit.internal.submodule;version="5.6.0";x-internal:=true,
+ org.eclipse.jgit.internal.transport.http;version="5.6.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.internal.transport.parser;version="5.6.0";x-friends:="org.eclipse.jgit.http.server,org.eclipse.jgit.test",
+ org.eclipse.jgit.internal.transport.ssh;version="5.6.0";x-friends:="org.eclipse.jgit.ssh.apache",
+ org.eclipse.jgit.lib;version="5.6.0";
uses:="org.eclipse.jgit.revwalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
@@ -99,33 +99,33 @@ Export-Package: org.eclipse.jgit.annotations;version="5.5.2",
org.eclipse.jgit.treewalk,
org.eclipse.jgit.transport,
org.eclipse.jgit.submodule",
- org.eclipse.jgit.lib.internal;version="5.5.2";x-internal:=true,
- org.eclipse.jgit.merge;version="5.5.2";
+ org.eclipse.jgit.lib.internal;version="5.6.0";x-friends:="org.eclipse.jgit.test",
+ org.eclipse.jgit.merge;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.diff,
org.eclipse.jgit.dircache,
org.eclipse.jgit.api",
- org.eclipse.jgit.nls;version="5.5.2",
- org.eclipse.jgit.notes;version="5.5.2";
+ org.eclipse.jgit.nls;version="5.6.0",
+ org.eclipse.jgit.notes;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.merge",
- org.eclipse.jgit.patch;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
- org.eclipse.jgit.revplot;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
- org.eclipse.jgit.revwalk;version="5.5.2";
+ org.eclipse.jgit.patch;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.diff",
+ org.eclipse.jgit.revplot;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.revwalk",
+ org.eclipse.jgit.revwalk;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.treewalk,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.diff,
org.eclipse.jgit.revwalk.filter",
- org.eclipse.jgit.revwalk.filter;version="5.5.2";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.file;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
- org.eclipse.jgit.storage.pack;version="5.5.2";uses:="org.eclipse.jgit.lib",
- org.eclipse.jgit.submodule;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
- org.eclipse.jgit.transport;version="5.5.2";
+ org.eclipse.jgit.revwalk.filter;version="5.6.0";uses:="org.eclipse.jgit.revwalk,org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.file;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.util",
+ org.eclipse.jgit.storage.pack;version="5.6.0";uses:="org.eclipse.jgit.lib",
+ org.eclipse.jgit.submodule;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.treewalk.filter,org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.transport;version="5.6.0";
uses:="org.eclipse.jgit.transport.resolver,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.internal.storage.pack,
@@ -138,24 +138,24 @@ Export-Package: org.eclipse.jgit.annotations;version="5.5.2",
org.eclipse.jgit.transport.http,
org.eclipse.jgit.errors,
org.eclipse.jgit.storage.pack",
- org.eclipse.jgit.transport.http;version="5.5.2";uses:="javax.net.ssl",
- org.eclipse.jgit.transport.resolver;version="5.5.2";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
- org.eclipse.jgit.treewalk;version="5.5.2";
+ org.eclipse.jgit.transport.http;version="5.6.0";uses:="javax.net.ssl",
+ org.eclipse.jgit.transport.resolver;version="5.6.0";uses:="org.eclipse.jgit.lib,org.eclipse.jgit.transport",
+ org.eclipse.jgit.treewalk;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.revwalk,
org.eclipse.jgit.attributes,
org.eclipse.jgit.treewalk.filter,
org.eclipse.jgit.util,
org.eclipse.jgit.dircache",
- org.eclipse.jgit.treewalk.filter;version="5.5.2";uses:="org.eclipse.jgit.treewalk",
- org.eclipse.jgit.util;version="5.5.2";
+ org.eclipse.jgit.treewalk.filter;version="5.6.0";uses:="org.eclipse.jgit.treewalk",
+ org.eclipse.jgit.util;version="5.6.0";
uses:="org.eclipse.jgit.lib,
org.eclipse.jgit.transport.http,
org.eclipse.jgit.storage.file,
org.ietf.jgss",
- org.eclipse.jgit.util.io;version="5.5.2",
- org.eclipse.jgit.util.sha1;version="5.5.2",
- org.eclipse.jgit.util.time;version="5.5.2"
+ org.eclipse.jgit.util.io;version="5.6.0",
+ org.eclipse.jgit.util.sha1;version="5.6.0",
+ org.eclipse.jgit.util.time;version="5.6.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.googlecode.javaewah;version="[1.1.6,2.0.0)",
com.jcraft.jsch;version="[0.1.37,0.2.0)",
diff --git a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
index 29db604cab..01c9aa0564 100644
--- a/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
+++ b/org.eclipse.jgit/META-INF/SOURCE-MANIFEST.MF
@@ -3,5 +3,5 @@ Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.jgit - Sources
Bundle-SymbolicName: org.eclipse.jgit.source
Bundle-Vendor: Eclipse.org - JGit
-Bundle-Version: 5.5.2.qualifier
-Eclipse-SourceBundle: org.eclipse.jgit;version="5.5.2.qualifier";roots="."
+Bundle-Version: 5.6.0.qualifier
+Eclipse-SourceBundle: org.eclipse.jgit;version="5.6.0.qualifier";roots="."
diff --git a/org.eclipse.jgit/pom.xml b/org.eclipse.jgit/pom.xml
index 656d4ff964..6b8cdaab1a 100644
--- a/org.eclipse.jgit/pom.xml
+++ b/org.eclipse.jgit/pom.xml
@@ -53,7 +53,7 @@
<parent>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jgit</artifactId>
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 6b09faf0a1..7391826c05 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -348,6 +348,7 @@ invalidFilter=Invalid filter: {0}
invalidGitdirRef = Invalid .git reference in file ''{0}''
invalidGitModules=Invalid .gitmodules file
invalidGitType=invalid git type: {0}
+invalidHooksPath=Invalid git config core.hooksPath = {0}
invalidId=Invalid id: {0}
invalidId0=Invalid id
invalidIdLength=Invalid id length {0}; should be {1}
@@ -448,6 +449,7 @@ noHMACsupport=No {0} support: {1}
noMergeBase=No merge base could be determined. Reason={0}. {1}
noMergeHeadSpecified=No merge head specified
nonBareLinkFilesNotSupported=Link files are not supported with nonbare repos
+nonCommitToHeads=Cannot point a branch to a non-commit object
noPathAttributesFound=No Attributes found for {0}.
noSuchRef=no such ref
noSuchSubmodule=no such submodule {0}
@@ -577,7 +579,7 @@ repositoryState_conflicts=Conflicts
repositoryState_merged=Merged
repositoryState_normal=Normal
repositoryState_rebase=Rebase
-repositoryState_rebaseInteractive=Rebase interactive
+repositoryState_rebaseInteractive=Interactive rebase
repositoryState_rebaseOrApplyMailbox=Rebase/Apply mailbox
repositoryState_rebaseWithMerge=Rebase w/merge
requiredHashFunctionNotAvailable=Required hash function {0} not available.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
index f7576e9e9b..0c765b01cb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java
@@ -275,13 +275,12 @@ public class BlameCommand extends GitCommand<BlameResult> {
byte[] buffer = new byte[upperSizeLimit];
try {
int read = IO.readFully(source, buffer, 0);
- if (read == upperSizeLimit)
+ if (read == upperSizeLimit) {
return buffer;
- else {
- byte[] copy = new byte[read];
- System.arraycopy(buffer, 0, copy, 0, read);
- return copy;
}
+ byte[] copy = new byte[read];
+ System.arraycopy(buffer, 0, copy, 0, read);
+ return copy;
} finally {
source.close();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
index c9dd547b49..aa63725c55 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -57,6 +57,7 @@ import org.eclipse.jgit.api.errors.UnmergedPathsException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.dircache.DirCacheCheckout;
import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.events.WorkingTreeModifiedEvent;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
@@ -129,9 +130,10 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
// get the head commit
Ref headRef = repo.exactRef(Constants.HEAD);
- if (headRef == null)
+ if (headRef == null) {
throw new NoHeadException(
JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
+ }
newHead = revWalk.parseCommit(headRef.getObjectId());
@@ -140,8 +142,9 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
// get the commit to be cherry-picked
// handle annotated tags
ObjectId srcObjectId = src.getPeeledObjectId();
- if (srcObjectId == null)
+ if (srcObjectId == null) {
srcObjectId = src.getObjectId();
+ }
RevCommit srcCommit = revWalk.parseCommit(srcObjectId);
// get the parent of the commit to cherry-pick
@@ -157,26 +160,33 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
merger.setCommitNames(new String[] { "BASE", ourName, //$NON-NLS-1$
cherryPickName });
if (merger.merge(newHead, srcCommit)) {
+ if (!merger.getModifiedFiles().isEmpty()) {
+ repo.fireEvent(new WorkingTreeModifiedEvent(
+ merger.getModifiedFiles(), null));
+ }
if (AnyObjectId.isEqual(newHead.getTree().getId(),
- merger.getResultTreeId()))
+ merger.getResultTreeId())) {
continue;
+ }
DirCacheCheckout dco = new DirCacheCheckout(repo,
newHead.getTree(), repo.lockDirCache(),
merger.getResultTreeId());
dco.setFailOnConflict(true);
dco.setProgressMonitor(monitor);
dco.checkout();
- if (!noCommit)
+ if (!noCommit) {
newHead = new Git(getRepository()).commit()
.setMessage(srcCommit.getFullMessage())
.setReflogComment(reflogPrefix + " " //$NON-NLS-1$
+ srcCommit.getShortMessage())
.setAuthor(srcCommit.getAuthorIdent())
.setNoVerify(true).call();
+ }
cherryPickedRefs.add(src);
} else {
- if (merger.failed())
+ if (merger.failed()) {
return new CherryPickResult(merger.getFailingPaths());
+ }
// there are merge conflicts
@@ -184,10 +194,14 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
.formatWithConflicts(srcCommit.getFullMessage(),
merger.getUnmergedPaths());
- if (!noCommit)
+ if (!noCommit) {
repo.writeCherryPickHead(srcCommit.getId());
+ }
repo.writeMergeCommitMsg(message);
+ repo.fireEvent(new WorkingTreeModifiedEvent(
+ merger.getModifiedFiles(), null));
+
return CherryPickResult.CONFLICT;
}
}
@@ -213,10 +227,11 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
Integer.valueOf(srcCommit.getParentCount())));
srcParent = srcCommit.getParent(0);
} else {
- if (mainlineParentNumber.intValue() > srcCommit.getParentCount())
+ if (mainlineParentNumber.intValue() > srcCommit.getParentCount()) {
throw new JGitInternalException(MessageFormat.format(
JGitText.get().commitDoesNotHaveGivenParent, srcCommit,
mainlineParentNumber));
+ }
srcParent = srcCommit
.getParent(mainlineParentNumber.intValue() - 1);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index 9f63d0f005..809f2d111a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -77,8 +77,8 @@ import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
import org.eclipse.jgit.transport.TagOpt;
import org.eclipse.jgit.transport.URIish;
-import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.FS;
+import org.eclipse.jgit.util.FileUtils;
/**
* Clone a repository into a new working directory
@@ -104,7 +104,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
- private boolean cloneAllBranches;
+ private FETCH_TYPE fetchType = FETCH_TYPE.ALL_BRANCHES;
private boolean cloneSubmodules;
@@ -118,6 +118,10 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
private boolean gitDirExistsInitially;
+ private enum FETCH_TYPE {
+ MULTIPLE_BRANCHES, ALL_BRANCHES, MIRROR
+ }
+
/**
* Callback for status of clone operation.
*
@@ -282,12 +286,11 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
config.addURI(u);
- final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES
- + config.getName() + '/') + '*';
- boolean fetchAll = cloneAllBranches || branchesToClone == null
- || branchesToClone.isEmpty();
+ boolean fetchAll = fetchType == FETCH_TYPE.ALL_BRANCHES
+ || fetchType == FETCH_TYPE.MIRROR;
- config.setFetchRefSpecs(calculateRefSpecs(fetchAll, dst));
+ config.setFetchRefSpecs(calculateRefSpecs(fetchType, config.getName()));
+ config.setMirror(fetchType == FETCH_TYPE.MIRROR);
config.update(clonedRepo.getConfig());
clonedRepo.getConfig().save();
@@ -302,26 +305,33 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
return command.call();
}
- private List<RefSpec> calculateRefSpecs(boolean fetchAll, String dst) {
- RefSpec heads = new RefSpec();
- heads = heads.setForceUpdate(true);
- heads = heads.setSourceDestination(Constants.R_HEADS + '*', dst);
+ private List<RefSpec> calculateRefSpecs(FETCH_TYPE type,
+ String remoteName) {
List<RefSpec> specs = new ArrayList<>();
- if (!fetchAll) {
- RefSpec tags = new RefSpec();
- tags = tags.setForceUpdate(true);
- tags = tags.setSourceDestination(Constants.R_TAGS + '*',
- Constants.R_TAGS + '*');
- for (String selectedRef : branchesToClone) {
- if (heads.matchSource(selectedRef)) {
- specs.add(heads.expandFromSource(selectedRef));
- } else if (tags.matchSource(selectedRef)) {
- specs.add(tags.expandFromSource(selectedRef));
+ if (type == FETCH_TYPE.MIRROR) {
+ specs.add(new RefSpec().setForceUpdate(true).setSourceDestination(
+ Constants.R_REFS + '*', Constants.R_REFS + '*'));
+ } else {
+ RefSpec heads = new RefSpec();
+ heads = heads.setForceUpdate(true);
+ final String dst = (bare ? Constants.R_HEADS
+ : Constants.R_REMOTES + remoteName + '/') + '*';
+ heads = heads.setSourceDestination(Constants.R_HEADS + '*', dst);
+ if (type == FETCH_TYPE.MULTIPLE_BRANCHES) {
+ RefSpec tags = new RefSpec().setForceUpdate(true)
+ .setSourceDestination(Constants.R_TAGS + '*',
+ Constants.R_TAGS + '*');
+ for (String selectedRef : branchesToClone) {
+ if (heads.matchSource(selectedRef)) {
+ specs.add(heads.expandFromSource(selectedRef));
+ } else if (tags.matchSource(selectedRef)) {
+ specs.add(tags.expandFromSource(selectedRef));
+ }
}
+ } else {
+ // We'll fetch the tags anyway.
+ specs.add(heads);
}
- } else {
- // We'll fetch the tags anyway.
- specs.add(heads);
}
return specs;
}
@@ -609,7 +619,31 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
* @return {@code this}
*/
public CloneCommand setCloneAllBranches(boolean cloneAllBranches) {
- this.cloneAllBranches = cloneAllBranches;
+ this.fetchType = cloneAllBranches ? FETCH_TYPE.ALL_BRANCHES
+ : this.fetchType;
+ return this;
+ }
+
+ /**
+ * Set up a mirror of the source repository. This implies that a bare
+ * repository will be created. Compared to {@link #setBare},
+ * {@code #setMirror} not only maps local branches of the source to local
+ * branches of the target, it maps all refs (including remote-tracking
+ * branches, notes etc.) and sets up a refspec configuration such that all
+ * these refs are overwritten by a git remote update in the target
+ * repository.
+ *
+ * @param mirror
+ * whether to mirror all refs from the source repository
+ *
+ * @return {@code this}
+ * @since 5.6
+ */
+ public CloneCommand setMirror(boolean mirror) {
+ if (mirror) {
+ this.fetchType = FETCH_TYPE.MIRROR;
+ setBare(true);
+ }
return this;
}
@@ -641,7 +675,13 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
* @return {@code this}
*/
public CloneCommand setBranchesToClone(Collection<String> branchesToClone) {
- this.branchesToClone = branchesToClone;
+ if (branchesToClone == null || branchesToClone.isEmpty()) {
+ // fallback to default
+ fetchType = FETCH_TYPE.ALL_BRANCHES;
+ } else {
+ this.fetchType = FETCH_TYPE.MULTIPLE_BRANCHES;
+ this.branchesToClone = branchesToClone;
+ }
return this;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
index f65b5735de..1c3c79041e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DiffCommand.java
@@ -136,28 +136,32 @@ public class DiffCommand extends GitCommand<List<DiffEntry>> {
}
newTree = new DirCacheIterator(repo.readDirCache());
} else {
- if (oldTree == null)
+ if (oldTree == null) {
oldTree = new DirCacheIterator(repo.readDirCache());
- if (newTree == null)
+ }
+ if (newTree == null) {
newTree = new FileTreeIterator(repo);
+ }
}
diffFmt.setPathFilter(pathFilter);
List<DiffEntry> result = diffFmt.scan(oldTree, newTree);
- if (showNameAndStatusOnly)
- return result;
- else {
- if (contextLines >= 0)
- diffFmt.setContext(contextLines);
- if (destinationPrefix != null)
- diffFmt.setNewPrefix(destinationPrefix);
- if (sourcePrefix != null)
- diffFmt.setOldPrefix(sourcePrefix);
- diffFmt.format(result);
- diffFmt.flush();
+ if (showNameAndStatusOnly) {
return result;
}
+ if (contextLines >= 0) {
+ diffFmt.setContext(contextLines);
+ }
+ if (destinationPrefix != null) {
+ diffFmt.setNewPrefix(destinationPrefix);
+ }
+ if (sourcePrefix != null) {
+ diffFmt.setOldPrefix(sourcePrefix);
+ }
+ diffFmt.format(result);
+ diffFmt.flush();
+ return result;
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
index 2c9c5f20cc..9020c58d46 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java
@@ -360,17 +360,17 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> {
* @return whether to remove refs which no longer exist in the source
*/
public boolean isRemoveDeletedRefs() {
- if (removeDeletedRefs != null)
+ if (removeDeletedRefs != null) {
return removeDeletedRefs.booleanValue();
- else { // fall back to configuration
- boolean result = false;
- StoredConfig config = repo.getConfig();
- result = config.getBoolean(ConfigConstants.CONFIG_FETCH_SECTION,
- null, ConfigConstants.CONFIG_KEY_PRUNE, result);
- result = config.getBoolean(ConfigConstants.CONFIG_REMOTE_SECTION,
- remote, ConfigConstants.CONFIG_KEY_PRUNE, result);
- return result;
}
+ // fall back to configuration
+ boolean result = false;
+ StoredConfig config = repo.getConfig();
+ result = config.getBoolean(ConfigConstants.CONFIG_FETCH_SECTION, null,
+ ConfigConstants.CONFIG_KEY_PRUNE, result);
+ result = config.getBoolean(ConfigConstants.CONFIG_REMOTE_SECTION,
+ remote, ConfigConstants.CONFIG_KEY_PRUNE, result);
+ return result;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java
index 7ea277157d..474e2f5736 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/GarbageCollectCommand.java
@@ -243,9 +243,8 @@ public class GarbageCollectCommand extends GitCommand<Properties> {
if (repo instanceof FileRepository) {
GC gc = new GC((FileRepository) repo);
return toProperties(gc.getStatistics());
- } else {
- return new Properties();
}
+ return new Properties();
} catch (IOException e) {
throw new JGitInternalException(
JGitText.get().couldNotGetRepoStatistics, e);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
index f9a9baf919..9a843f63a0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -409,27 +409,24 @@ public class MergeCommand extends GitCommand<MergeResult> {
new ObjectId[] { headCommit.getId(),
srcCommit.getId() }, mergeStatus,
mergeStrategy, null, msg);
- } else {
- if (failingPaths != null) {
- repo.writeMergeCommitMsg(null);
- repo.writeMergeHeads(null);
- return new MergeResult(null, merger.getBaseCommitId(),
- new ObjectId[] {
- headCommit.getId(), srcCommit.getId() },
- MergeStatus.FAILED, mergeStrategy,
- lowLevelResults, failingPaths, null);
- } else {
- String mergeMessageWithConflicts = new MergeMessageFormatter()
- .formatWithConflicts(mergeMessage,
- unmergedPaths);
- repo.writeMergeCommitMsg(mergeMessageWithConflicts);
- return new MergeResult(null, merger.getBaseCommitId(),
- new ObjectId[] { headCommit.getId(),
- srcCommit.getId() },
- MergeStatus.CONFLICTING, mergeStrategy,
- lowLevelResults, null);
- }
}
+ if (failingPaths != null) {
+ repo.writeMergeCommitMsg(null);
+ repo.writeMergeHeads(null);
+ return new MergeResult(null, merger.getBaseCommitId(),
+ new ObjectId[] { headCommit.getId(),
+ srcCommit.getId() },
+ MergeStatus.FAILED, mergeStrategy, lowLevelResults,
+ failingPaths, null);
+ }
+ String mergeMessageWithConflicts = new MergeMessageFormatter()
+ .formatWithConflicts(mergeMessage, unmergedPaths);
+ repo.writeMergeCommitMsg(mergeMessageWithConflicts);
+ return new MergeResult(null, merger.getBaseCommitId(),
+ new ObjectId[] { headCommit.getId(),
+ srcCommit.getId() },
+ MergeStatus.CONFLICTING, mergeStrategy, lowLevelResults,
+ null);
}
} catch (org.eclipse.jgit.errors.CheckoutConflictException e) {
List<String> conflicts = (dco == null) ? Collections
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index bdb2d1bbc5..834b68d6d0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -315,23 +315,24 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> {
Ref r = null;
if (fetchRes != null) {
r = fetchRes.getAdvertisedRef(remoteBranchName);
- if (r == null)
+ if (r == null) {
r = fetchRes.getAdvertisedRef(Constants.R_HEADS
+ remoteBranchName);
+ }
}
if (r == null) {
throw new RefNotAdvertisedException(MessageFormat.format(
JGitText.get().couldNotGetAdvertisedRef, remote,
remoteBranchName));
- } else {
- commitToMerge = r.getObjectId();
}
+ commitToMerge = r.getObjectId();
} else {
try {
commitToMerge = repo.resolve(remoteBranchName);
- if (commitToMerge == null)
+ if (commitToMerge == null) {
throw new RefNotFoundException(MessageFormat.format(
JGitText.get().refNotResolved, remoteBranchName));
+ }
} catch (IOException e) {
throw new JGitInternalException(
JGitText.get().exceptionCaughtDuringExecutionOfPullCommand,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index 0dacd4dfbf..715d9768d8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -509,10 +509,10 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
monitor.beginTask(MessageFormat.format(
JGitText.get().applyingCommit,
commitToPick.getShortMessage()), ProgressMonitor.UNKNOWN);
- if (preserveMerges)
+ if (preserveMerges) {
return cherryPickCommitPreservingMerges(commitToPick);
- else
- return cherryPickCommitFlattening(commitToPick);
+ }
+ return cherryPickCommitFlattening(commitToPick);
} finally {
monitor.endTask();
}
@@ -539,11 +539,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
.call();
switch (cherryPickResult.getStatus()) {
case FAILED:
- if (operation == Operation.BEGIN)
+ if (operation == Operation.BEGIN) {
return abort(RebaseResult
.failed(cherryPickResult.getFailingPaths()));
- else
- return stop(commitToPick, Status.STOPPED);
+ }
+ return stop(commitToPick, Status.STOPPED);
case CONFLICTING:
return stop(commitToPick, Status.STOPPED);
case OK:
@@ -599,11 +599,11 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
CherryPickResult cherryPickResult = pickCommand.call();
switch (cherryPickResult.getStatus()) {
case FAILED:
- if (operation == Operation.BEGIN)
+ if (operation == Operation.BEGIN) {
return abort(RebaseResult.failed(
cherryPickResult.getFailingPaths()));
- else
- return stop(commitToPick, Status.STOPPED);
+ }
+ return stop(commitToPick, Status.STOPPED);
case CONFLICTING:
return stop(commitToPick, Status.STOPPED);
case OK:
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
index d7c9ad5e04..3031a197a8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
@@ -334,10 +334,10 @@ public class ResetCommand extends GitCommand<Ref> {
}
private String getRefOrHEAD() {
- if (ref != null)
+ if (ref != null) {
return ref;
- else
- return Constants.HEAD;
+ }
+ return Constants.HEAD;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
index ddd60b6fa2..aa0055fb53 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -58,6 +58,7 @@ import org.eclipse.jgit.api.errors.NoMessageException;
import org.eclipse.jgit.api.errors.UnmergedPathsException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.dircache.DirCacheCheckout;
+import org.eclipse.jgit.events.WorkingTreeModifiedEvent;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
@@ -175,6 +176,10 @@ public class RevertCommand extends GitCommand<RevCommit> {
+ "This reverts commit " + srcCommit.getId().getName() //$NON-NLS-1$
+ ".\n"; //$NON-NLS-1$
if (merger.merge(headCommit, srcParent)) {
+ if (!merger.getModifiedFiles().isEmpty()) {
+ repo.fireEvent(new WorkingTreeModifiedEvent(
+ merger.getModifiedFiles(), null));
+ }
if (AnyObjectId.isEqual(headCommit.getTree().getId(),
merger.getResultTreeId()))
continue;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
index 52393695d9..74def9e897 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java
@@ -106,10 +106,10 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> {
*/
protected String getHeadBranch(Repository subRepo) throws IOException {
Ref head = subRepo.exactRef(Constants.HEAD);
- if (head != null && head.isSymbolic())
+ if (head != null && head.isSymbolic()) {
return Repository.shortenRefName(head.getLeaf().getName());
- else
- return null;
+ }
+ return null;
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java
index 5fb77501fa..394aba6a59 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/BlameResult.java
@@ -267,18 +267,18 @@ public class BlameResult {
*/
public int computeNext() throws IOException {
BlameGenerator gen = generator;
- if (gen == null)
+ if (gen == null) {
return -1;
+ }
if (gen.next()) {
loadFrom(gen);
lastLength = gen.getRegionLength();
return gen.getResultStart();
- } else {
- gen.close();
- generator = null;
- return -1;
}
+ gen.close();
+ generator = null;
+ return -1;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
index 1cecff6fb0..fa552aabe1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
@@ -489,8 +489,8 @@ public class DiffFormatter implements AutoCloseable {
CanonicalTreeParser parser = new CanonicalTreeParser();
parser.reset(reader, tree);
return parser;
- } else
- return new EmptyTreeIterator();
+ }
+ return new EmptyTreeIterator();
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
index 5c876e87fd..831074d2e1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
@@ -125,17 +125,17 @@ public class Edit {
*/
public final Type getType() {
if (beginA < endA) {
- if (beginB < endB)
+ if (beginB < endB) {
return Type.REPLACE;
- else /* if (beginB == endB) */
- return Type.DELETE;
-
- } else /* if (beginA == endA) */{
- if (beginB < endB)
- return Type.INSERT;
- else /* if (beginB == endB) */
- return Type.EMPTY;
+ }
+ return Type.DELETE;
+
+ }
+ if (beginB < endB) {
+ return Type.INSERT;
}
+ // beginB == endB)
+ return Type.EMPTY;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
index 6c0d90ebad..219da0e9b9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java
@@ -383,15 +383,17 @@ public class RawText extends Sequence {
* @return the line delimiter or <code>null</code>
*/
public String getLineDelimiter() {
- if (size() == 0)
+ if (size() == 0) {
return null;
+ }
int e = getEnd(0);
- if (content[e - 1] != '\n')
+ if (content[e - 1] != '\n') {
return null;
- if (content.length > 1 && e > 1 && content[e - 2] == '\r')
+ }
+ if (content.length > 1 && e > 1 && content[e - 2] == '\r') {
return "\r\n"; //$NON-NLS-1$
- else
- return "\n"; //$NON-NLS-1$
+ }
+ return "\n"; //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 6bc2946078..bbaed3766e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -53,9 +53,11 @@ import java.text.MessageFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.eclipse.jgit.api.errors.CanceledException;
import org.eclipse.jgit.api.errors.FilterFailedException;
@@ -142,6 +144,8 @@ public class DirCacheCheckout {
private ArrayList<String> removed = new ArrayList<>();
+ private ArrayList<String> kept = new ArrayList<>();
+
private ObjectId mergeCommitTree;
private DirCache dc;
@@ -432,11 +436,11 @@ public class DirCacheCheckout {
if (mtime == null || mtime.equals(Instant.EPOCH)) {
entry.setLastModified(f.getEntryLastModifiedInstant());
}
- keep(entry, f);
+ keep(i.getEntryPathString(), entry, f);
}
} else
// The index contains a folder
- keep(i.getDirCacheEntry(), f);
+ keep(i.getEntryPathString(), i.getDirCacheEntry(), f);
} else {
// There is no entry in the merge commit. Means: we want to delete
// what's currently in the index and working tree
@@ -496,8 +500,11 @@ public class DirCacheCheckout {
dc.unlock();
} finally {
if (performingCheckout) {
+ Set<String> touched = new HashSet<>(conflicts);
+ touched.addAll(getUpdated().keySet());
+ touched.addAll(kept);
WorkingTreeModifiedEvent event = new WorkingTreeModifiedEvent(
- getUpdated().keySet(), getRemoved());
+ touched, getRemoved());
if (!event.isEmpty()) {
repo.fireEvent(event);
}
@@ -517,10 +524,10 @@ public class DirCacheCheckout {
prescanOneTree();
if (!conflicts.isEmpty()) {
- if (failOnConflict)
+ if (failOnConflict) {
throw new CheckoutConflictException(conflicts.toArray(new String[0]));
- else
- cleanUpConflicts();
+ }
+ cleanUpConflicts();
}
// update our index
@@ -826,14 +833,14 @@ public class DirCacheCheckout {
break;
case 0xDFD: // 3 4
- keep(dce, f);
+ keep(name, dce, f);
break;
case 0xF0D: // 18
remove(name);
break;
case 0xDFF: // 5 5b 6 6b
if (equalIdAndMode(iId, iMode, mId, mMode))
- keep(dce, f); // 5 6
+ keep(name, dce, f); // 5 6
else
conflict(name, dce, h, m); // 5b 6b
break;
@@ -863,7 +870,7 @@ public class DirCacheCheckout {
conflict(name, dce, h, m); // 9
break;
case 0xFD0: // keep without a rule
- keep(dce, f);
+ keep(name, dce, f);
break;
case 0xFFD: // 12 13 14
if (equalIdAndMode(hId, hMode, iId, iMode))
@@ -883,7 +890,7 @@ public class DirCacheCheckout {
conflict(name, dce, h, m);
break;
default:
- keep(dce, f);
+ keep(name, dce, f);
}
return;
}
@@ -895,15 +902,14 @@ public class DirCacheCheckout {
// the workingtree entry doesn't exist or also contains a folder
// -> no problem
return;
- } else {
- // the workingtree entry exists and is not a folder
- if (!idEqual(h, m)) {
- // Because HEAD and MERGE differ we will try to update the
- // workingtree with a folder -> return a conflict
- conflict(name, null, null, null);
- }
- return;
}
+ // the workingtree entry exists and is not a folder
+ if (!idEqual(h, m)) {
+ // Because HEAD and MERGE differ we will try to update the
+ // workingtree with a folder -> return a conflict
+ conflict(name, null, null, null);
+ }
+ return;
}
if ((ffMask == 0x00F) && f != null && FileMode.TREE.equals(f.getEntryFileMode())) {
@@ -969,7 +975,7 @@ public class DirCacheCheckout {
if (initialCheckout)
update(name, mId, mMode);
else
- keep(dce, f);
+ keep(name, dce, f);
} else
conflict(name, dce, h, m);
}
@@ -1032,7 +1038,7 @@ public class DirCacheCheckout {
// Nothing in Head
// Something in Index
// -> Merge contains nothing new. Keep the index.
- keep(dce, f);
+ keep(name, dce, f);
} else
// Merge contains something and it is not the same as Index
// Nothing in Head
@@ -1083,15 +1089,15 @@ public class DirCacheCheckout {
// Something in Head
if (!FileMode.TREE.equals(f.getEntryFileMode())
- && FileMode.TREE.equals(iMode))
+ && FileMode.TREE.equals(iMode)) {
// The workingtree contains a file and the index semantically contains a folder.
// Git considers the workingtree file as untracked. Just keep the untracked file.
return;
- else
- // -> file is dirty and tracked but is should be
- // removed. That's a conflict
- conflict(name, dce, h, m);
- } else
+ }
+ // -> file is dirty and tracked but is should be
+ // removed. That's a conflict
+ conflict(name, dce, h, m);
+ } else {
// file doesn't exist or is clean
// Index contains the same as Head
// Something different from a submodule in Index
@@ -1099,7 +1105,8 @@ public class DirCacheCheckout {
// Something in Head
// -> Remove from index and delete the file
remove(name);
- } else
+ }
+ } else {
// Index contains something different from Head
// Something different from a submodule in Index
// Nothing in Merge
@@ -1108,6 +1115,7 @@ public class DirCacheCheckout {
// filesystem). But Merge wants the path to be removed.
// Report a conflict
conflict(name, dce, h, m);
+ }
}
} else {
// Something in Merge
@@ -1181,7 +1189,7 @@ public class DirCacheCheckout {
// to the other one.
// -> In all three cases we don't touch index and file.
- keep(dce, f);
+ keep(name, dce, f);
}
}
}
@@ -1230,13 +1238,17 @@ public class DirCacheCheckout {
}
}
- private void keep(DirCacheEntry e, WorkingTreeIterator f)
+ private void keep(String path, DirCacheEntry e, WorkingTreeIterator f)
throws IOException {
if (e != null && !FileMode.TREE.equals(e.getFileMode()))
builder.add(e);
if (force) {
- if (f.isModified(e, true, this.walk.getObjectReader())) {
- checkoutEntry(repo, e, this.walk.getObjectReader());
+ if (f.isModified(e, true, walk.getObjectReader())) {
+ kept.add(path);
+ checkoutEntry(repo, e, walk.getObjectReader(), false,
+ new CheckoutMetadata(walk.getEolStreamType(CHECKOUT_OP),
+ walk.getFilterCommand(
+ Constants.ATTR_FILTER_TYPE_SMUDGE)));
}
}
}
@@ -1340,13 +1352,14 @@ public class DirCacheCheckout {
private boolean isModified_IndexTree(String path, ObjectId iId,
FileMode iMode, ObjectId tId, FileMode tMode, ObjectId rootTree)
throws CorruptObjectException, IOException {
- if (iMode != tMode)
+ if (iMode != tMode) {
return true;
+ }
if (FileMode.TREE.equals(iMode)
- && (iId == null || ObjectId.zeroId().equals(iId)))
+ && (iId == null || ObjectId.zeroId().equals(iId))) {
return isModifiedSubtree_IndexTree(path, rootTree);
- else
- return !equalIdAndMode(iId, iMode, tId, tMode);
+ }
+ return !equalIdAndMode(iId, iMode, tId, tMode);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
index 0e91f0d748..cbf96e468c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
@@ -824,10 +824,10 @@ public class DirCacheEntry {
}
private int getExtendedFlags() {
- if (isExtended())
+ if (isExtended()) {
return NB.decodeUInt16(info, infoOffset + P_FLAGS2) << 16;
- else
- return 0;
+ }
+ return 0;
}
private static void checkPath(byte[] path) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
index 60669bb955..2c93d55f4d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
@@ -82,10 +82,10 @@ abstract class AbstractHead implements Head {
/** {@inheritDoc} */
@Override
public List<Head> getNextHeads(char c) {
- if (matches(c))
+ if (matches(c)) {
return newHeads;
- else
- return FileNameMatcher.EMPTY_HEAD_LIST;
+ }
+ return FileNameMatcher.EMPTY_HEAD_LIST;
}
boolean isStar() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
index bfcc580ba4..8125c356a6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
@@ -304,11 +304,11 @@ public class FileNameMatcher {
private static AbstractHead createWildCardHead(
final Character invalidWildgetCharacter, final boolean star) {
- if (invalidWildgetCharacter != null)
+ if (invalidWildgetCharacter != null) {
return new RestrictedWildCardHead(invalidWildgetCharacter
.charValue(), star);
- else
- return new WildCardHead(star);
+ }
+ return new WildCardHead(star);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
index 8e463415b8..febdb92091 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java
@@ -293,13 +293,12 @@ public class ManifestParser extends DefaultHandler {
String revision = defaultRevision;
if (remote == null) {
if (defaultRemote == null) {
- if (filename != null)
+ if (filename != null) {
throw new SAXException(MessageFormat.format(
RepoText.get().errorNoDefaultFilename,
filename));
- else
- throw new SAXException(
- RepoText.get().errorNoDefault);
+ }
+ throw new SAXException(RepoText.get().errorNoDefault);
}
remote = defaultRemote;
} else {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
index cb62925a1f..7288678007 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java
@@ -761,18 +761,17 @@ public class RepoCommand extends GitCommand<RevCommit> {
} catch (GitAPIException | IOException e) {
throw new ManifestErrorException(e);
}
- } else {
- try (Git git = new Git(repo)) {
- for (RepoProject proj : filteredProjects) {
- addSubmodule(proj.getName(), proj.getUrl(), proj.getPath(),
- proj.getRevision(), proj.getCopyFiles(),
- proj.getLinkFiles(), git);
- }
- return git.commit().setMessage(RepoText.get().repoCommitMessage)
- .call();
- } catch (GitAPIException | IOException e) {
- throw new ManifestErrorException(e);
+ }
+ try (Git git = new Git(repo)) {
+ for (RepoProject proj : filteredProjects) {
+ addSubmodule(proj.getName(), proj.getUrl(), proj.getPath(),
+ proj.getRevision(), proj.getCopyFiles(),
+ proj.getLinkFiles(), git);
}
+ return git.commit().setMessage(RepoText.get().repoCommitMessage)
+ .call();
+ } catch (GitAPIException | IOException e) {
+ throw new ManifestErrorException(e);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java
index d79dfa8b2f..684d1e457f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java
@@ -422,10 +422,10 @@ public class RepoProject implements Comparable<RepoProject> {
}
private String getPathWithSlash() {
- if (path.endsWith("/")) //$NON-NLS-1$
+ if (path.endsWith("/")) { //$NON-NLS-1$
return path;
- else
- return path + "/"; //$NON-NLS-1$
+ }
+ return path + "/"; //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
index ad43e2ca83..6bb5bfc4c4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/hooks/GitHook.java
@@ -162,9 +162,14 @@ abstract class GitHook<T> implements Callable<T> {
} catch (UnsupportedEncodingException e) {
// UTF-8 is guaranteed to be available
}
- ProcessResult result = FS.DETECTED.runHookIfPresent(getRepository(),
- getHookName(), getParameters(), getOutputStream(),
- hookErrRedirect, getStdinArgs());
+ Repository repository = getRepository();
+ FS fs = repository.getFS();
+ if (fs == null) {
+ fs = FS.DETECTED;
+ }
+ ProcessResult result = fs.runHookIfPresent(repository, getHookName(),
+ getParameters(), getOutputStream(), hookErrRedirect,
+ getStdinArgs());
if (result.isExecutedWithError()) {
throw new AbortedByHookException(
new String(errorByteArray.toByteArray(), UTF_8),
@@ -180,7 +185,11 @@ abstract class GitHook<T> implements Callable<T> {
* @since 4.11
*/
public boolean isNativeHookPresent() {
- return FS.DETECTED.findHook(getRepository(), getHookName()) != null;
+ FS fs = getRepository().getFS();
+ if (fs == null) {
+ fs = FS.DETECTED;
+ }
+ return fs.findHook(getRepository(), getHookName()) != null;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
index 3c0f17ab3d..b7d6acce14 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java
@@ -291,26 +291,25 @@ public class PathMatcher extends AbstractMatcher {
// We had a prefix match here.
if (!pathMatch) {
return true;
+ }
+ if (right == endExcl - 1) {
+ // Extra slash at the end: actually a full match.
+ // Must meet directory expectations
+ return !dirOnly || assumeDirectory;
+ }
+ // Prefix matches only if pattern ended with /**
+ if (wasWild) {
+ return true;
+ }
+ if (lastWildmatch >= 0) {
+ // Consider pattern **/x and input x/x.
+ // We've matched the prefix x/ so far: we
+ // must try to extend the **!
+ matcher = lastWildmatch + 1;
+ right = wildmatchBacktrackPos;
+ wildmatchBacktrackPos = -1;
} else {
- if (right == endExcl - 1) {
- // Extra slash at the end: actually a full match.
- // Must meet directory expectations
- return !dirOnly || assumeDirectory;
- }
- // Prefix matches only if pattern ended with /**
- if (wasWild) {
- return true;
- }
- if (lastWildmatch >= 0) {
- // Consider pattern **/x and input x/x.
- // We've matched the prefix x/ so far: we
- // must try to extend the **!
- matcher = lastWildmatch + 1;
- right = wildmatchBacktrackPos;
- wildmatchBacktrackPos = -1;
- } else {
- return false;
- }
+ return false;
}
}
} else if (lastWildmatch != -1) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
index 41923eed18..b18aed9828 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
@@ -192,22 +192,20 @@ public class Strings {
}
if (pattern.indexOf('?') != -1) {
return true;
- } else {
- // check if the backslash escapes one of the glob special characters
- // if not, backslash is not part of a regex and treated literally
- int backSlash = pattern.indexOf('\\');
- if (backSlash >= 0) {
- int nextIdx = backSlash + 1;
- if (pattern.length() == nextIdx) {
- return false;
- }
- char nextChar = pattern.charAt(nextIdx);
- if (escapedByBackslash(nextChar)) {
- return true;
- } else {
- return false;
- }
+ }
+ // check if the backslash escapes one of the glob special characters
+ // if not, backslash is not part of a regex and treated literally
+ int backSlash = pattern.indexOf('\\');
+ if (backSlash >= 0) {
+ int nextIdx = backSlash + 1;
+ if (pattern.length() == nextIdx) {
+ return false;
+ }
+ char nextChar = pattern.charAt(nextIdx);
+ if (escapedByBackslash(nextChar)) {
+ return true;
}
+ return false;
}
return false;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index 6a7d22df9d..2357e8ee99 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -409,6 +409,7 @@ public class JGitText extends TranslationBundle {
/***/ public String invalidGitdirRef;
/***/ public String invalidGitModules;
/***/ public String invalidGitType;
+ /***/ public String invalidHooksPath;
/***/ public String invalidId;
/***/ public String invalidId0;
/***/ public String invalidIdLength;
@@ -509,6 +510,7 @@ public class JGitText extends TranslationBundle {
/***/ public String noMergeBase;
/***/ public String noMergeHeadSpecified;
/***/ public String nonBareLinkFilesNotSupported;
+ /***/ public String nonCommitToHeads;
/***/ public String noPathAttributesFound;
/***/ public String noSuchRef;
/***/ public String noSuchSubmodule;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/LagCheck.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/LagCheck.java
index 53fd198006..a27a9bc446 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/LagCheck.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/ketch/LagCheck.java
@@ -132,9 +132,8 @@ class LagCheck implements AutoCloseable {
// TODO(sop) Check term to see if my leader was deposed.
if (rw.isMergedInto(head, remote)) {
return AHEAD;
- } else {
- return DIVERGENT;
}
+ return DIVERGENT;
} catch (IOException err) {
KetchReplica.log.error(String.format(
"Cannot compare %s", //$NON-NLS-1$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
index c6e2fae42f..16e7a0d537 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java
@@ -412,8 +412,7 @@ public final class DfsBlockCache {
getStat(statMiss, key).incrementAndGet();
boolean credit = true;
try {
- v = file.readOneBlock(requestedPosition, ctx,
- fileChannel.get());
+ v = file.readOneBlock(position, ctx, fileChannel.get());
credit = false;
} finally {
if (credit) {
@@ -450,7 +449,7 @@ public final class DfsBlockCache {
}
@SuppressWarnings("unchecked")
- private void reserveSpace(int reserve, DfsStreamKey key) {
+ private void reserveSpace(long reserve, DfsStreamKey key) {
clockLock.lock();
try {
long live = LongStream.of(getCurrentSize()).sum() + reserve;
@@ -487,7 +486,7 @@ public final class DfsBlockCache {
}
}
- private void creditSpace(int credit, DfsStreamKey key) {
+ private void creditSpace(long credit, DfsStreamKey key) {
clockLock.lock();
try {
getStat(liveBytes, key).addAndGet(-credit);
@@ -497,7 +496,7 @@ public final class DfsBlockCache {
}
@SuppressWarnings("unchecked")
- private void addToClock(Ref ref, int credit) {
+ private void addToClock(Ref ref, long credit) {
clockLock.lock();
try {
if (credit != 0) {
@@ -521,17 +520,20 @@ public final class DfsBlockCache {
*
* @param key
* the stream key of the pack.
+ * @param position
+ * the position in the key. The default should be 0.
* @param loader
* the function to load the reference.
* @return the object reference.
* @throws IOException
* the reference was not in the cache and could not be loaded.
*/
- <T> Ref<T> getOrLoadRef(DfsStreamKey key, RefLoader<T> loader)
+ <T> Ref<T> getOrLoadRef(
+ DfsStreamKey key, long position, RefLoader<T> loader)
throws IOException {
- int slot = slot(key, 0);
+ int slot = slot(key, position);
HashEntry e1 = table.get(slot);
- Ref<T> ref = scanRef(e1, key, 0);
+ Ref<T> ref = scanRef(e1, key, position);
if (ref != null) {
getStat(statHit, key).incrementAndGet();
return ref;
@@ -543,7 +545,7 @@ public final class DfsBlockCache {
try {
HashEntry e2 = table.get(slot);
if (e2 != e1) {
- ref = scanRef(e2, key, 0);
+ ref = scanRef(e2, key, position);
if (ref != null) {
getStat(statHit, key).incrementAndGet();
return ref;
@@ -574,10 +576,10 @@ public final class DfsBlockCache {
}
<T> Ref<T> putRef(DfsStreamKey key, long size, T v) {
- return put(key, 0, (int) Math.min(size, Integer.MAX_VALUE), v);
+ return put(key, 0, size, v);
}
- <T> Ref<T> put(DfsStreamKey key, long pos, int size, T v) {
+ <T> Ref<T> put(DfsStreamKey key, long pos, long size, T v) {
int slot = slot(key, pos);
HashEntry e1 = table.get(slot);
Ref<T> ref = scanRef(e1, key, pos);
@@ -720,12 +722,12 @@ public final class DfsBlockCache {
static final class Ref<T> {
final DfsStreamKey key;
final long position;
- final int size;
+ final long size;
volatile T value;
Ref next;
volatile boolean hot;
- Ref(DfsStreamKey key, long position, int size, T v) {
+ Ref(DfsStreamKey key, long position, long size, T v) {
this.key = key;
this.position = position;
this.size = size;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsCachedPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsCachedPack.java
index 3605236e56..9b280747df 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsCachedPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsCachedPack.java
@@ -61,6 +61,13 @@ public class DfsCachedPack extends CachedPack {
}
/**
+ * @return the pack passed to the constructor
+ */
+ public DfsPackFile getPackFile() {
+ return pack;
+ }
+
+ /**
* Get the description of the pack.
*
* @return the description of the pack.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
index f10a1d8127..3e71d079b5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
@@ -744,11 +744,15 @@ public class DfsGarbageCollector {
return;
}
- try (ReftableStack stack = ReftableStack.open(ctx, reftablesBefore)) {
- ReftableCompactor compact = new ReftableCompactor();
+ try (DfsReftableStack stack = DfsReftableStack.open(ctx, reftablesBefore);
+ DfsOutputStream out = objdb.writeFile(pack, REFTABLE)) {
+ ReftableCompactor compact = new ReftableCompactor(out);
compact.addAll(stack.readers());
compact.setIncludeDeletes(includeDeletes);
- compactReftable(pack, compact);
+ compact.setConfig(configureReftable(reftableConfig, out));
+ compact.compact();
+ pack.addFileExt(REFTABLE);
+ pack.setReftableStats(compact.getStats());
}
}
@@ -765,24 +769,12 @@ public class DfsGarbageCollector {
throws IOException {
try (DfsOutputStream out = objdb.writeFile(pack, REFTABLE)) {
ReftableConfig cfg = configureReftable(reftableConfig, out);
- ReftableWriter writer = new ReftableWriter(cfg)
+ ReftableWriter writer = new ReftableWriter(cfg, out)
.setMinUpdateIndex(reftableInitialMinUpdateIndex)
- .setMaxUpdateIndex(reftableInitialMaxUpdateIndex)
- .begin(out)
- .sortAndWriteRefs(refs)
- .finish();
+ .setMaxUpdateIndex(reftableInitialMaxUpdateIndex).begin()
+ .sortAndWriteRefs(refs).finish();
pack.addFileExt(REFTABLE);
pack.setReftableStats(writer.getStats());
}
}
-
- private void compactReftable(DfsPackDescription pack,
- ReftableCompactor compact) throws IOException {
- try (DfsOutputStream out = objdb.writeFile(pack, REFTABLE)) {
- compact.setConfig(configureReftable(reftableConfig, out));
- compact.compact(out);
- pack.addFileExt(REFTABLE);
- pack.setReftableStats(compact.getStats());
- }
- }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
index 6f3f2bd8e7..083124e5ed 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java
@@ -311,12 +311,16 @@ public class DfsPackCompactor {
DfsObjDatabase objdb = repo.getObjectDatabase();
Collections.sort(srcReftables, objdb.reftableComparator());
- try (ReftableStack stack = ReftableStack.open(ctx, srcReftables)) {
- initOutDesc(objdb);
- ReftableCompactor compact = new ReftableCompactor();
+ initOutDesc(objdb);
+ try (DfsReftableStack stack = DfsReftableStack.open(ctx, srcReftables);
+ DfsOutputStream out = objdb.writeFile(outDesc, REFTABLE)) {
+ ReftableCompactor compact = new ReftableCompactor(out);
compact.addAll(stack.readers());
compact.setIncludeDeletes(true);
- writeReftable(objdb, outDesc, compact);
+ compact.setConfig(configureReftable(reftableConfig, out));
+ compact.compact();
+ outDesc.addFileExt(REFTABLE);
+ outDesc.setReftableStats(compact.getStats());
}
}
@@ -497,16 +501,6 @@ public class DfsPackCompactor {
}
}
- private void writeReftable(DfsObjDatabase objdb, DfsPackDescription pack,
- ReftableCompactor compact) throws IOException {
- try (DfsOutputStream out = objdb.writeFile(pack, REFTABLE)) {
- compact.setConfig(configureReftable(reftableConfig, out));
- compact.compact(out);
- pack.addFileExt(REFTABLE);
- pack.setReftableStats(compact.getStats());
- }
- }
-
static ReftableConfig configureReftable(ReftableConfig cfg,
DfsOutputStream out) {
int bs = out.blockSize();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
index be1387ed0c..d0f9b1c1f4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java
@@ -89,6 +89,7 @@ import org.eclipse.jgit.util.LongList;
*/
public final class DfsPackFile extends BlockBasedFile {
private static final int REC_SIZE = Constants.OBJECT_ID_LENGTH + 8;
+ private static final long REF_POSITION = 0;
/**
* Lock for initialization of {@link #index} and {@link #corruptObjects}.
@@ -194,45 +195,10 @@ public final class DfsPackFile extends BlockBasedFile {
try {
DfsStreamKey idxKey = desc.getStreamKey(INDEX);
- DfsBlockCache.Ref<PackIndex> idxref = cache.getOrLoadRef(idxKey,
- () -> {
- try {
- ctx.stats.readIdx++;
- long start = System.nanoTime();
- try (ReadableChannel rc = ctx.db.openFile(desc,
- INDEX)) {
- InputStream in = Channels
- .newInputStream(rc);
- int wantSize = 8192;
- int bs = rc.blockSize();
- if (0 < bs && bs < wantSize) {
- bs = (wantSize / bs) * bs;
- } else if (bs <= 0) {
- bs = wantSize;
- }
- PackIndex idx = PackIndex.read(
- new BufferedInputStream(in, bs));
- int sz = (int) Math.min(
- idx.getObjectCount() * REC_SIZE,
- Integer.MAX_VALUE);
- ctx.stats.readIdxBytes += rc.position();
- index = idx;
- return new DfsBlockCache.Ref<>(idxKey, 0,
- sz, idx);
- } finally {
- ctx.stats.readIdxMicros += elapsedMicros(
- start);
- }
- } catch (EOFException e) {
- throw new IOException(MessageFormat.format(
- DfsText.get().shortReadOfIndex,
- desc.getFileName(INDEX)), e);
- } catch (IOException e) {
- throw new IOException(MessageFormat.format(
- DfsText.get().cannotReadIndex,
- desc.getFileName(INDEX)), e);
- }
- });
+ DfsBlockCache.Ref<PackIndex> idxref = cache.getOrLoadRef(
+ idxKey,
+ REF_POSITION,
+ () -> loadPackIndex(ctx, idxKey));
PackIndex idx = idxref.get();
if (index == null && idx != null) {
index = idx;
@@ -267,44 +233,10 @@ public final class DfsPackFile extends BlockBasedFile {
PackIndex idx = idx(ctx);
PackReverseIndex revidx = getReverseIdx(ctx);
DfsStreamKey bitmapKey = desc.getStreamKey(BITMAP_INDEX);
- DfsBlockCache.Ref<PackBitmapIndex> idxref = cache
- .getOrLoadRef(bitmapKey, () -> {
- ctx.stats.readBitmap++;
- long start = System.nanoTime();
- try (ReadableChannel rc = ctx.db.openFile(desc,
- BITMAP_INDEX)) {
- long size;
- PackBitmapIndex bmidx;
- try {
- InputStream in = Channels.newInputStream(rc);
- int wantSize = 8192;
- int bs = rc.blockSize();
- if (0 < bs && bs < wantSize) {
- bs = (wantSize / bs) * bs;
- } else if (bs <= 0) {
- bs = wantSize;
- }
- in = new BufferedInputStream(in, bs);
- bmidx = PackBitmapIndex.read(in, idx, revidx);
- } finally {
- size = rc.position();
- ctx.stats.readIdxBytes += size;
- ctx.stats.readIdxMicros += elapsedMicros(start);
- }
- int sz = (int) Math.min(size, Integer.MAX_VALUE);
- bitmapIndex = bmidx;
- return new DfsBlockCache.Ref<>(bitmapKey, 0, sz,
- bmidx);
- } catch (EOFException e) {
- throw new IOException(MessageFormat.format(
- DfsText.get().shortReadOfIndex,
- desc.getFileName(BITMAP_INDEX)), e);
- } catch (IOException e) {
- throw new IOException(MessageFormat.format(
- DfsText.get().cannotReadIndex,
- desc.getFileName(BITMAP_INDEX)), e);
- }
- });
+ DfsBlockCache.Ref<PackBitmapIndex> idxref = cache.getOrLoadRef(
+ bitmapKey,
+ REF_POSITION,
+ () -> loadBitmapIndex(ctx, bitmapKey, idx, revidx));
PackBitmapIndex bmidx = idxref.get();
if (bitmapIndex == null && bmidx != null) {
bitmapIndex = bmidx;
@@ -326,14 +258,10 @@ public final class DfsPackFile extends BlockBasedFile {
PackIndex idx = idx(ctx);
DfsStreamKey revKey = new DfsStreamKey.ForReverseIndex(
desc.getStreamKey(INDEX));
- DfsBlockCache.Ref<PackReverseIndex> revref = cache
- .getOrLoadRef(revKey, () -> {
- PackReverseIndex revidx = new PackReverseIndex(idx);
- int sz = (int) Math.min(idx.getObjectCount() * 8,
- Integer.MAX_VALUE);
- reverseIndex = revidx;
- return new DfsBlockCache.Ref<>(revKey, 0, sz, revidx);
- });
+ DfsBlockCache.Ref<PackReverseIndex> revref = cache.getOrLoadRef(
+ revKey,
+ REF_POSITION,
+ () -> loadReverseIdx(revKey, idx));
PackReverseIndex revidx = revref.get();
if (reverseIndex == null && revidx != null) {
reverseIndex = revidx;
@@ -1091,4 +1019,91 @@ public final class DfsPackFile extends BlockBasedFile {
list.add(offset);
}
}
+
+ private DfsBlockCache.Ref<PackIndex> loadPackIndex(
+ DfsReader ctx, DfsStreamKey idxKey) throws IOException {
+ try {
+ ctx.stats.readIdx++;
+ long start = System.nanoTime();
+ try (ReadableChannel rc = ctx.db.openFile(desc, INDEX)) {
+ InputStream in = Channels.newInputStream(rc);
+ int wantSize = 8192;
+ int bs = rc.blockSize();
+ if (0 < bs && bs < wantSize) {
+ bs = (wantSize / bs) * bs;
+ } else if (bs <= 0) {
+ bs = wantSize;
+ }
+ PackIndex idx = PackIndex.read(new BufferedInputStream(in, bs));
+ ctx.stats.readIdxBytes += rc.position();
+ index = idx;
+ return new DfsBlockCache.Ref<>(
+ idxKey,
+ REF_POSITION,
+ idx.getObjectCount() * REC_SIZE,
+ idx);
+ } finally {
+ ctx.stats.readIdxMicros += elapsedMicros(start);
+ }
+ } catch (EOFException e) {
+ throw new IOException(MessageFormat.format(
+ DfsText.get().shortReadOfIndex,
+ desc.getFileName(INDEX)), e);
+ } catch (IOException e) {
+ throw new IOException(MessageFormat.format(
+ DfsText.get().cannotReadIndex,
+ desc.getFileName(INDEX)), e);
+ }
+ }
+
+ private DfsBlockCache.Ref<PackReverseIndex> loadReverseIdx(
+ DfsStreamKey revKey, PackIndex idx) {
+ PackReverseIndex revidx = new PackReverseIndex(idx);
+ reverseIndex = revidx;
+ return new DfsBlockCache.Ref<>(
+ revKey,
+ REF_POSITION,
+ idx.getObjectCount() * 8,
+ revidx);
+ }
+
+ private DfsBlockCache.Ref<PackBitmapIndex> loadBitmapIndex(
+ DfsReader ctx,
+ DfsStreamKey bitmapKey,
+ PackIndex idx,
+ PackReverseIndex revidx) throws IOException {
+ ctx.stats.readBitmap++;
+ long start = System.nanoTime();
+ try (ReadableChannel rc = ctx.db.openFile(desc, BITMAP_INDEX)) {
+ long size;
+ PackBitmapIndex bmidx;
+ try {
+ InputStream in = Channels.newInputStream(rc);
+ int wantSize = 8192;
+ int bs = rc.blockSize();
+ if (0 < bs && bs < wantSize) {
+ bs = (wantSize / bs) * bs;
+ } else if (bs <= 0) {
+ bs = wantSize;
+ }
+ in = new BufferedInputStream(in, bs);
+ bmidx = PackBitmapIndex.read(in, idx, revidx);
+ } finally {
+ size = rc.position();
+ ctx.stats.readIdxBytes += size;
+ ctx.stats.readIdxMicros += elapsedMicros(start);
+ }
+ bitmapIndex = bmidx;
+ return new DfsBlockCache.Ref<>(
+ bitmapKey, REF_POSITION, size, bmidx);
+ } catch (EOFException e) {
+ throw new IOException(MessageFormat.format(
+ DfsText.get().shortReadOfIndex,
+ desc.getFileName(BITMAP_INDEX)), e);
+ } catch (IOException e) {
+ throw new IOException(MessageFormat.format(
+ DfsText.get().cannotReadIndex,
+ desc.getFileName(BITMAP_INDEX)), e);
+ }
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
index 732cd4d1c6..b3b9e39375 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
@@ -191,14 +191,11 @@ public abstract class DfsRefDatabase extends RefDatabase {
rw.peel(obj).copy(),
hasVersioning() ? leaf.getUpdateIndex()
: UNDEFINED_UPDATE_INDEX);
- } else {
- return new ObjectIdRef.PeeledNonTag(
- leaf.getStorage(),
- leaf.getName(),
- leaf.getObjectId(),
- hasVersioning() ? leaf.getUpdateIndex()
- : UNDEFINED_UPDATE_INDEX);
}
+ return new ObjectIdRef.PeeledNonTag(leaf.getStorage(),
+ leaf.getName(), leaf.getObjectId(),
+ hasVersioning() ? leaf.getUpdateIndex()
+ : UNDEFINED_UPDATE_INDEX);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableBatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableBatchRefUpdate.java
new file mode 100644
index 0000000000..124630edb7
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableBatchRefUpdate.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2019, 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.internal.storage.dfs;
+
+import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
+import org.eclipse.jgit.internal.storage.io.BlockSource;
+import org.eclipse.jgit.internal.storage.pack.PackExt;
+import org.eclipse.jgit.internal.storage.reftable.ReftableBatchRefUpdate;
+import org.eclipse.jgit.internal.storage.reftable.ReftableCompactor;
+import org.eclipse.jgit.internal.storage.reftable.ReftableConfig;
+import org.eclipse.jgit.internal.storage.reftable.ReftableReader;
+import org.eclipse.jgit.internal.storage.reftable.ReftableWriter;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.transport.ReceiveCommand;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import static org.eclipse.jgit.internal.storage.pack.PackExt.REFTABLE;
+
+/**
+ * {@link org.eclipse.jgit.lib.BatchRefUpdate} for
+ * {@link org.eclipse.jgit.internal.storage.dfs.DfsReftableDatabase}.
+ */
+public class DfsReftableBatchRefUpdate extends ReftableBatchRefUpdate {
+ private static final int AVG_BYTES = 36;
+
+ private final DfsReftableDatabase refdb;
+
+ private final DfsObjDatabase odb;
+
+ /**
+ * Initialize batch update.
+ *
+ * @param refdb
+ * database the update will modify.
+ * @param odb
+ * object database to store the reftable.
+ */
+ protected DfsReftableBatchRefUpdate(DfsReftableDatabase refdb,
+ DfsObjDatabase odb) {
+ super(refdb, refdb.reftableDatabase, refdb.getLock(), refdb.getRepository());
+ this.refdb = refdb;
+ this.odb = odb;
+ }
+
+ @Override
+ protected void applyUpdates(List<Ref> newRefs, List<ReceiveCommand> pending)
+ throws IOException {
+ Set<DfsPackDescription> prune = Collections.emptySet();
+ DfsPackDescription pack = odb.newPack(PackSource.INSERT);
+ try (DfsOutputStream out = odb.writeFile(pack, REFTABLE)) {
+ ReftableConfig cfg = DfsPackCompactor
+ .configureReftable(refdb.getReftableConfig(), out);
+
+ ReftableWriter.Stats stats;
+ if (refdb.compactDuringCommit()
+ && newRefs.size() * AVG_BYTES <= cfg.getRefBlockSize()
+ && canCompactTopOfStack(cfg)) {
+ ByteArrayOutputStream tmp = new ByteArrayOutputStream();
+ ReftableWriter rw = new ReftableWriter(cfg, tmp);
+ write(rw, newRefs, pending);
+ rw.finish();
+ stats = compactTopOfStack(out, cfg, tmp.toByteArray());
+ prune = toPruneTopOfStack();
+ } else {
+ ReftableWriter rw = new ReftableWriter(cfg, out);
+ write(rw, newRefs, pending);
+ rw.finish();
+ stats = rw.getStats();
+ }
+ pack.addFileExt(REFTABLE);
+ pack.setReftableStats(stats);
+ }
+
+ odb.commitPack(Collections.singleton(pack), prune);
+ odb.addReftable(pack, prune);
+ refdb.clearCache();
+ }
+
+ private boolean canCompactTopOfStack(ReftableConfig cfg)
+ throws IOException {
+ refdb.getLock().lock();
+ try {
+ DfsReftableStack stack = refdb.stack();
+ List<ReftableReader> readers = stack.readers();
+ if (readers.isEmpty()) {
+ return false;
+ }
+
+ int lastIdx = readers.size() - 1;
+ DfsReftable last = stack.files().get(lastIdx);
+ DfsPackDescription desc = last.getPackDescription();
+ if (desc.getPackSource() != PackSource.INSERT
+ || !packOnlyContainsReftable(desc)) {
+ return false;
+ }
+
+ ReftableReader table = readers.get(lastIdx);
+ int bs = cfg.getRefBlockSize();
+ return table.size() <= 3 * bs;
+ } finally {
+ refdb.getLock().unlock();
+ }
+ }
+
+ private ReftableWriter.Stats compactTopOfStack(OutputStream out,
+ ReftableConfig cfg, byte[] newTable) throws IOException {
+ refdb.getLock().lock();
+ try {
+ List<ReftableReader> stack = refdb.stack().readers();
+
+ ReftableReader last = stack.get(stack.size() - 1);
+
+ List<ReftableReader> tables = new ArrayList<>(2);
+ tables.add(last);
+ tables.add(new ReftableReader(BlockSource.from(newTable)));
+
+ ReftableCompactor compactor = new ReftableCompactor(out);
+ compactor.setConfig(cfg);
+ compactor.setIncludeDeletes(true);
+ compactor.addAll(tables);
+ compactor.compact();
+ return compactor.getStats();
+ } finally {
+ refdb.getLock().unlock();
+ }
+ }
+
+ private Set<DfsPackDescription> toPruneTopOfStack() throws IOException {
+ refdb.getLock().lock();
+ try {
+ List<DfsReftable> stack = refdb.stack().files();
+
+ DfsReftable last = stack.get(stack.size() - 1);
+ return Collections.singleton(last.getPackDescription());
+ } finally {
+ refdb.getLock().unlock();
+ }
+ }
+
+ private boolean packOnlyContainsReftable(DfsPackDescription desc) {
+ for (PackExt ext : PackExt.values()) {
+ if (ext != REFTABLE && desc.hasFileExt(ext)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java
index 6050c15992..2ad3ae7e62 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableDatabase.java
@@ -45,19 +45,17 @@ package org.eclipse.jgit.internal.storage.dfs;
import java.io.IOException;
import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.internal.storage.reftable.MergedReftable;
-import org.eclipse.jgit.internal.storage.reftable.RefCursor;
-import org.eclipse.jgit.internal.storage.reftable.Reftable;
import org.eclipse.jgit.internal.storage.reftable.ReftableConfig;
+import org.eclipse.jgit.internal.storage.reftable.ReftableDatabase;
import org.eclipse.jgit.lib.BatchRefUpdate;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
@@ -81,13 +79,10 @@ import org.eclipse.jgit.util.RefMap;
* and one will fail.
*/
public class DfsReftableDatabase extends DfsRefDatabase {
- private final ReentrantLock lock = new ReentrantLock(true);
+ final ReftableDatabase reftableDatabase;
private DfsReader ctx;
-
- private ReftableStack tableStack;
-
- private MergedReftable mergedTables;
+ private DfsReftableStack stack;
/**
* Initialize the reference database for a repository.
@@ -97,6 +92,18 @@ public class DfsReftableDatabase extends DfsRefDatabase {
*/
protected DfsReftableDatabase(DfsRepository repo) {
super(repo);
+ reftableDatabase = new ReftableDatabase() {
+ @Override
+ public MergedReftable openMergedReftable() throws IOException {
+ DfsReftableDatabase.this.getLock().lock();
+ try {
+ return new MergedReftable(stack().readers());
+ } finally {
+ DfsReftableDatabase.this.getLock().unlock();
+ }
+ }
+ };
+ stack = null;
}
/** {@inheritDoc} */
@@ -115,7 +122,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
@Override
public BatchRefUpdate newBatchUpdate() {
DfsObjDatabase odb = getRepository().getObjectDatabase();
- return new ReftableBatchRefUpdate(this, odb);
+ return new DfsReftableBatchRefUpdate(this, odb);
}
/**
@@ -124,7 +131,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
* @return configuration to write new reftables with.
*/
public ReftableConfig getReftableConfig() {
- return new ReftableConfig(getRepository().getConfig());
+ return new ReftableConfig(getRepository());
}
/**
@@ -133,7 +140,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
* @return the lock protecting this instance's state.
*/
protected ReentrantLock getLock() {
- return lock;
+ return reftableDatabase.getLock();
}
/**
@@ -147,134 +154,57 @@ public class DfsReftableDatabase extends DfsRefDatabase {
return true;
}
- /**
- * Obtain a handle to the merged reader.
- *
- * @return (possibly cached) handle to the merged reader.
- * @throws java.io.IOException
- * if tables cannot be opened.
- */
- protected Reftable reader() throws IOException {
- lock.lock();
- try {
- if (mergedTables == null) {
- mergedTables = new MergedReftable(stack().readers());
- }
- return mergedTables;
- } finally {
- lock.unlock();
- }
- }
/**
- * Obtain a handle to the stack of reftables.
+ * Obtain a handle to the stack of reftables. Must hold lock.
*
* @return (possibly cached) handle to the stack.
* @throws java.io.IOException
* if tables cannot be opened.
*/
- protected ReftableStack stack() throws IOException {
- lock.lock();
- try {
- if (tableStack == null) {
- DfsObjDatabase odb = getRepository().getObjectDatabase();
- if (ctx == null) {
- ctx = odb.newReader();
- }
- tableStack = ReftableStack.open(ctx,
- Arrays.asList(odb.getReftables()));
- }
- return tableStack;
- } finally {
- lock.unlock();
+ protected DfsReftableStack stack() throws IOException {
+ if (!getLock().isLocked()) {
+ throw new IllegalStateException("most hold lock to access stack"); //$NON-NLS-1$
}
+ DfsObjDatabase odb = getRepository().getObjectDatabase();
+
+ if (ctx == null) {
+ ctx = odb.newReader();
+ }
+ if (stack == null) {
+ stack = DfsReftableStack.open(ctx, Arrays.asList(odb.getReftables()));
+ }
+ return stack;
}
- /** {@inheritDoc} */
@Override
public boolean isNameConflicting(String refName) throws IOException {
- lock.lock();
- try {
- Reftable table = reader();
-
- // Cannot be nested within an existing reference.
- int lastSlash = refName.lastIndexOf('/');
- while (0 < lastSlash) {
- if (table.hasRef(refName.substring(0, lastSlash))) {
- return true;
- }
- lastSlash = refName.lastIndexOf('/', lastSlash - 1);
- }
-
- // Cannot be the container of an existing reference.
- return table.hasRefsWithPrefix(refName + '/');
- } finally {
- lock.unlock();
- }
+ return reftableDatabase.isNameConflicting(refName, new TreeSet<>(), new HashSet<>());
}
/** {@inheritDoc} */
@Override
public Ref exactRef(String name) throws IOException {
- lock.lock();
- try {
- Reftable table = reader();
- Ref ref = table.exactRef(name);
- if (ref != null && ref.isSymbolic()) {
- return table.resolve(ref);
- }
- return ref;
- } finally {
- lock.unlock();
- }
+ return reftableDatabase.exactRef(name);
}
/** {@inheritDoc} */
@Override
public Map<String, Ref> getRefs(String prefix) throws IOException {
- RefList.Builder<Ref> all = new RefList.Builder<>();
- lock.lock();
- try {
- Reftable table = reader();
- try (RefCursor rc = ALL.equals(prefix) ? table.allRefs()
- : (prefix.endsWith("/") ? table.seekRefsWithPrefix(prefix) //$NON-NLS-1$
- : table.seekRef(prefix))) {
- while (rc.next()) {
- Ref ref = table.resolve(rc.getRef());
- if (ref != null && ref.getObjectId() != null) {
- all.add(ref);
- }
- }
- }
- } finally {
- lock.unlock();
+ List<Ref> refs = reftableDatabase.getRefsByPrefix(prefix);
+ RefList.Builder<Ref> builder = new RefList.Builder<>(refs.size());
+ for (Ref r : refs) {
+ builder.add(r);
}
-
- RefList<Ref> none = RefList.emptyList();
- return new RefMap(prefix, all.toRefList(), none, none);
+ return new RefMap(prefix, builder.toRefList(), RefList.emptyList(),
+ RefList.emptyList());
}
/** {@inheritDoc} */
@Override
public List<Ref> getRefsByPrefix(String prefix) throws IOException {
- List<Ref> all = new ArrayList<>();
- lock.lock();
- try {
- Reftable table = reader();
- try (RefCursor rc = ALL.equals(prefix) ? table.allRefs()
- : table.seekRefsWithPrefix(prefix)) {
- while (rc.next()) {
- Ref ref = table.resolve(rc.getRef());
- if (ref != null && ref.getObjectId() != null) {
- all.add(ref);
- }
- }
- }
- } finally {
- lock.unlock();
- }
- return Collections.unmodifiableList(all);
+ return reftableDatabase.getRefsByPrefix(prefix);
}
/** {@inheritDoc} */
@@ -283,17 +213,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
if (!getReftableConfig().isIndexObjects()) {
return super.getTipsWithSha1(id);
}
- lock.lock();
- try {
- RefCursor cursor = reader().byObjectId(id);
- Set<Ref> refs = new HashSet<>();
- while (cursor.next()) {
- refs.add(cursor.getRef());
- }
- return refs;
- } finally {
- lock.unlock();
- }
+ return reftableDatabase.getTipsWithSha1(id);
}
/** {@inheritDoc} */
@@ -314,19 +234,19 @@ public class DfsReftableDatabase extends DfsRefDatabase {
@Override
void clearCache() {
- lock.lock();
+ getLock().lock();
try {
- if (tableStack != null) {
- tableStack.close();
- tableStack = null;
- }
if (ctx != null) {
ctx.close();
ctx = null;
}
- mergedTables = null;
+ reftableDatabase.clearCache();
+ if (stack != null) {
+ stack.close();
+ stack = null;
+ }
} finally {
- lock.unlock();
+ getLock().unlock();
}
}
@@ -334,7 +254,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
@Override
protected boolean compareAndPut(Ref oldRef, @Nullable Ref newRef)
throws IOException {
- ReceiveCommand cmd = toCommand(oldRef, newRef);
+ ReceiveCommand cmd = ReftableDatabase.toCommand(oldRef, newRef);
try (RevWalk rw = new RevWalk(getRepository())) {
rw.setRetainBody(false);
newBatchUpdate().setAllowNonFastForwards(true).addCommand(cmd)
@@ -351,58 +271,6 @@ public class DfsReftableDatabase extends DfsRefDatabase {
}
}
- private static ReceiveCommand toCommand(Ref oldRef, Ref newRef) {
- ObjectId oldId = toId(oldRef);
- ObjectId newId = toId(newRef);
- String name = toName(oldRef, newRef);
-
- if (oldRef != null && oldRef.isSymbolic()) {
- if (newRef != null) {
- if (newRef.isSymbolic()) {
- return ReceiveCommand.link(oldRef.getTarget().getName(),
- newRef.getTarget().getName(), name);
- } else {
- return ReceiveCommand.unlink(oldRef.getTarget().getName(),
- newId, name);
- }
- } else {
- return ReceiveCommand.unlink(oldRef.getTarget().getName(),
- ObjectId.zeroId(), name);
- }
- }
-
- if (newRef != null && newRef.isSymbolic()) {
- if (oldRef != null) {
- if (oldRef.isSymbolic()) {
- return ReceiveCommand.link(oldRef.getTarget().getName(),
- newRef.getTarget().getName(), name);
- } else {
- return ReceiveCommand.link(oldId,
- newRef.getTarget().getName(), name);
- }
- } else {
- return ReceiveCommand.link(ObjectId.zeroId(),
- newRef.getTarget().getName(), name);
- }
- }
-
- return new ReceiveCommand(oldId, newId, name);
- }
-
- private static ObjectId toId(Ref ref) {
- if (ref != null) {
- ObjectId id = ref.getObjectId();
- if (id != null) {
- return id;
- }
- }
- return ObjectId.zeroId();
- }
-
- private static String toName(Ref oldRef, Ref newRef) {
- return oldRef != null ? oldRef.getName() : newRef.getName();
- }
-
/** {@inheritDoc} */
@Override
protected boolean compareAndRemove(Ref oldRef) throws IOException {
@@ -417,12 +285,12 @@ public class DfsReftableDatabase extends DfsRefDatabase {
@Override
void stored(Ref ref) {
- // Unnecessary; ReftableBatchRefUpdate calls clearCache().
+ // Unnecessary; DfsReftableBatchRefUpdate calls clearCache().
}
@Override
void removed(String refName) {
- // Unnecessary; ReftableBatchRefUpdate calls clearCache().
+ // Unnecessary; DfsReftableBatchRefUpdate calls clearCache().
}
/** {@inheritDoc} */
@@ -430,4 +298,5 @@ public class DfsReftableDatabase extends DfsRefDatabase {
protected void cachePeeledState(Ref oldLeaf, Ref newLeaf) {
// Do not cache peeled state in reftable.
}
+
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableStack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableStack.java
index 50ba0e0f38..59621a4e67 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableStack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReftableStack.java
@@ -48,13 +48,13 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.eclipse.jgit.internal.storage.reftable.Reftable;
+import org.eclipse.jgit.internal.storage.reftable.ReftableReader;
/**
* Tracks multiple open
- * {@link org.eclipse.jgit.internal.storage.reftable.Reftable} instances.
+ * {@link org.eclipse.jgit.internal.storage.reftable.ReftableReader} instances.
*/
-public class ReftableStack implements AutoCloseable {
+public class DfsReftableStack implements AutoCloseable {
/**
* Opens a stack of tables for reading.
*
@@ -67,9 +67,9 @@ public class ReftableStack implements AutoCloseable {
* @throws java.io.IOException
* a table could not be opened
*/
- public static ReftableStack open(DfsReader ctx, List<DfsReftable> files)
+ public static DfsReftableStack open(DfsReader ctx, List<DfsReftable> files)
throws IOException {
- ReftableStack stack = new ReftableStack(files.size());
+ DfsReftableStack stack = new DfsReftableStack(files.size());
boolean close = true;
try {
for (DfsReftable t : files) {
@@ -86,9 +86,9 @@ public class ReftableStack implements AutoCloseable {
}
private final List<DfsReftable> files;
- private final List<Reftable> tables;
+ private final List<ReftableReader> tables;
- private ReftableStack(int tableCnt) {
+ private DfsReftableStack(int tableCnt) {
this.files = new ArrayList<>(tableCnt);
this.tables = new ArrayList<>(tableCnt);
}
@@ -109,14 +109,14 @@ public class ReftableStack implements AutoCloseable {
* @return unmodifiable list of tables, in the same order the files were
* passed to {@link #open(DfsReader, List)}.
*/
- public List<Reftable> readers() {
+ public List<ReftableReader> readers() {
return Collections.unmodifiableList(tables);
}
/** {@inheritDoc} */
@Override
public void close() {
- for (Reftable t : tables) {
+ for (ReftableReader t : tables) {
try {
t.close();
} catch (IOException e) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
index 4f5f8a613e..130e39b149 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java
@@ -358,9 +358,8 @@ public class FileRepository extends Repository {
File directory = getDirectory();
if (directory != null) {
return directory.getPath();
- } else {
- throw new IllegalStateException();
}
+ throw new IllegalStateException();
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
index 82458c1acf..13b9e79be8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GcLog.java
@@ -152,11 +152,10 @@ class GcLog {
boolean commit() {
if (nonEmpty) {
return lock.commit();
- } else {
- logFile.delete();
- lock.unlock();
- return true;
}
+ logFile.delete();
+ lock.unlock();
+ return true;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java
index e5a54e372c..09f2021686 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java
@@ -109,10 +109,9 @@ class ObjectDirectoryInserter extends ObjectInserter {
ObjectId id = idFor(type, data, off, len);
if (!createDuplicate && db.has(id)) {
return id;
- } else {
- File tmp = toTemp(type, data, off, len);
- return insertOneObject(tmp, id, createDuplicate);
}
+ File tmp = toTemp(type, data, off, len);
+ return insertOneObject(tmp, id, createDuplicate);
}
/** {@inheritDoc} */
@@ -141,12 +140,11 @@ class ObjectDirectoryInserter extends ObjectInserter {
int actLen = IO.readFully(is, buf, 0);
return insert(type, buf, 0, actLen, createDuplicate);
- } else {
- SHA1 md = digest();
- File tmp = toTemp(md, type, len, is);
- ObjectId id = md.toObjectId();
- return insertOneObject(tmp, id, createDuplicate);
}
+ SHA1 md = digest();
+ File tmp = toTemp(md, type, len, is);
+ ObjectId id = md.toObjectId();
+ return insertOneObject(tmp, id, createDuplicate);
}
private ObjectId insertOneObject(
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
index 88e05af414..9b9c3a7dec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java
@@ -844,19 +844,20 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
case Constants.OBJ_TREE:
case Constants.OBJ_BLOB:
case Constants.OBJ_TAG: {
- if (delta != null || sz < curs.getStreamFileThreshold())
+ if (delta != null || sz < curs.getStreamFileThreshold()) {
data = decompress(pos + p, (int) sz, curs);
+ }
if (delta != null) {
type = typeCode;
break SEARCH;
}
- if (data != null)
+ if (data != null) {
return new ObjectLoader.SmallObject(typeCode, data);
- else
- return new LargePackedWholeObject(typeCode, sz, pos, p,
- this, curs.db);
+ }
+ return new LargePackedWholeObject(typeCode, sz, pos, p,
+ this, curs.db);
}
case Constants.OBJ_OFS_DELTA: {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index e5cea6c010..7733df15f9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -594,10 +594,9 @@ public class RefDirectory extends RefDatabase {
if (obj instanceof RevTag) {
return new ObjectIdRef.PeeledTag(leaf.getStorage(), leaf
.getName(), leaf.getObjectId(), rw.peel(obj).copy());
- } else {
- return new ObjectIdRef.PeeledNonTag(leaf.getStorage(), leaf
- .getName(), leaf.getObjectId());
}
+ return new ObjectIdRef.PeeledNonTag(leaf.getStorage(),
+ leaf.getName(), leaf.getObjectId());
}
}
@@ -894,10 +893,9 @@ public class RefDirectory extends RefDatabase {
if (peeledObjectId != null) {
return new ObjectIdRef.PeeledTag(PACKED, f.getName(),
f.getObjectId(), peeledObjectId);
- } else {
- return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(),
- f.getObjectId());
}
+ return new ObjectIdRef.PeeledNonTag(PACKED, f.getName(),
+ f.getObjectId());
}
void log(boolean force, RefUpdate update, String msg, boolean deref)
@@ -1480,10 +1478,8 @@ public class RefDirectory extends RefDatabase {
if (peeledObjectId != null) {
return new LoosePeeledTag(snapShot, getName(),
objectId, peeledObjectId);
- } else {
- return new LooseNonTag(snapShot, getName(),
- objectId);
}
+ return new LooseNonTag(snapShot, getName(), objectId);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
index 1a0d6953ab..dc4967fe4e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectoryUpdate.java
@@ -90,9 +90,8 @@ class RefDirectoryUpdate extends RefUpdate {
dst = database.findRef(name);
setOldObjectId(dst != null ? dst.getObjectId() : null);
return true;
- } else {
- return false;
}
+ return false;
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java
index 08a14b28d2..3cdd90408e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogEntryImpl.java
@@ -140,9 +140,9 @@ public class ReflogEntryImpl implements Serializable, ReflogEntry {
/** {@inheritDoc} */
@Override
public CheckoutEntry parseCheckout() {
- if (getComment().startsWith(CheckoutEntryImpl.CHECKOUT_MOVING_FROM))
+ if (getComment().startsWith(CheckoutEntryImpl.CHECKOUT_MOVING_FROM)) {
return new CheckoutEntryImpl(this);
- else
- return null;
+ }
+ return null;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java
index 131f716cf0..98d6ea00e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogWriter.java
@@ -61,6 +61,7 @@ import java.nio.channels.FileChannel;
import java.text.MessageFormat;
import org.eclipse.jgit.internal.JGitText;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.ObjectId;
@@ -68,6 +69,7 @@ import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.ReflogEntry;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.util.FileUtils;
/**
@@ -239,7 +241,7 @@ public class ReflogWriter {
private ReflogWriter log(String refName, byte[] rec) throws IOException {
File log = refdb.logFor(refName);
boolean write = forceWrite
- || (isLogAllRefUpdates() && shouldAutoCreateLog(refName))
+ || shouldAutoCreateLog(refName)
|| log.isFile();
if (!write)
return this;
@@ -260,15 +262,27 @@ public class ReflogWriter {
return this;
}
- private boolean isLogAllRefUpdates() {
- return refdb.getRepository().getConfig().get(CoreConfig.KEY)
- .isLogAllRefUpdates();
- }
-
private boolean shouldAutoCreateLog(String refName) {
- return refName.equals(HEAD)
- || refName.startsWith(R_HEADS)
- || refName.startsWith(R_REMOTES)
- || refName.startsWith(R_NOTES);
+ Repository repo = refdb.getRepository();
+ CoreConfig.LogRefUpdates value = repo.isBare()
+ ? CoreConfig.LogRefUpdates.FALSE
+ : CoreConfig.LogRefUpdates.TRUE;
+ value = repo.getConfig().getEnum(ConfigConstants.CONFIG_CORE_SECTION,
+ null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, value);
+ if (value != null) {
+ switch (value) {
+ case FALSE:
+ break;
+ case TRUE:
+ return refName.equals(HEAD) || refName.startsWith(R_HEADS)
+ || refName.startsWith(R_REMOTES)
+ || refName.startsWith(R_NOTES);
+ case ALWAYS:
+ return refName.equals(HEAD) || refName.startsWith(R_REFS);
+ default:
+ break;
+ }
+ }
+ return false;
}
} \ No newline at end of file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java
index 79f1307578..fb06623d7e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObject.java
@@ -139,49 +139,48 @@ public class UnpackedObject {
}
return new LargeObject(type, size, path, id, wc.db);
- } else {
- readSome(in, hdr, 2, 18);
- int c = hdr[0] & 0xff;
- int type = (c >> 4) & 7;
- long size = c & 15;
- int shift = 4;
- int p = 1;
- while ((c & 0x80) != 0) {
- c = hdr[p++] & 0xff;
- size += ((long) (c & 0x7f)) << shift;
- shift += 7;
- }
+ }
+ readSome(in, hdr, 2, 18);
+ int c = hdr[0] & 0xff;
+ int type = (c >> 4) & 7;
+ long size = c & 15;
+ int shift = 4;
+ int p = 1;
+ while ((c & 0x80) != 0) {
+ c = hdr[p++] & 0xff;
+ size += ((long) (c & 0x7f)) << shift;
+ shift += 7;
+ }
- switch (type) {
- case Constants.OBJ_COMMIT:
- case Constants.OBJ_TREE:
- case Constants.OBJ_BLOB:
- case Constants.OBJ_TAG:
- // Acceptable types for a loose object.
- break;
- default:
- throw new CorruptObjectException(id,
- JGitText.get().corruptObjectInvalidType);
- }
+ switch (type) {
+ case Constants.OBJ_COMMIT:
+ case Constants.OBJ_TREE:
+ case Constants.OBJ_BLOB:
+ case Constants.OBJ_TAG:
+ // Acceptable types for a loose object.
+ break;
+ default:
+ throw new CorruptObjectException(id,
+ JGitText.get().corruptObjectInvalidType);
+ }
- if (path == null && Integer.MAX_VALUE < size) {
- LargeObjectException.ExceedsByteArrayLimit e;
- e = new LargeObjectException.ExceedsByteArrayLimit();
- e.setObjectId(id);
- throw e;
- }
- if (size < wc.getStreamFileThreshold() || path == null) {
- in.reset();
- IO.skipFully(in, p);
- Inflater inf = wc.inflater();
- InputStream zIn = inflate(in, inf);
- byte[] data = new byte[(int) size];
- IO.readFully(zIn, data, 0, data.length);
- checkValidEndOfStream(in, inf, id, hdr);
- return new ObjectLoader.SmallObject(type, data);
- }
- return new LargeObject(type, size, path, id, wc.db);
+ if (path == null && Integer.MAX_VALUE < size) {
+ LargeObjectException.ExceedsByteArrayLimit e;
+ e = new LargeObjectException.ExceedsByteArrayLimit();
+ e.setObjectId(id);
+ throw e;
}
+ if (size < wc.getStreamFileThreshold() || path == null) {
+ in.reset();
+ IO.skipFully(in, p);
+ Inflater inf = wc.inflater();
+ InputStream zIn = inflate(in, inf);
+ byte[] data = new byte[(int) size];
+ IO.readFully(zIn, data, 0, data.length);
+ checkValidEndOfStream(in, inf, id, hdr);
+ return new ObjectLoader.SmallObject(type, data);
+ }
+ return new LargeObject(type, size, path, id, wc.db);
} catch (ZipException badStream) {
throw new CorruptObjectException(id,
JGitText.get().corruptObjectBadStream);
@@ -213,19 +212,18 @@ public class UnpackedObject {
JGitText.get().corruptObjectNegativeSize);
return size;
- } else {
- readSome(in, hdr, 2, 18);
- int c = hdr[0] & 0xff;
- long size = c & 15;
- int shift = 4;
- int p = 1;
- while ((c & 0x80) != 0) {
- c = hdr[p++] & 0xff;
- size += ((long) (c & 0x7f)) << shift;
- shift += 7;
- }
- return size;
}
+ readSome(in, hdr, 2, 18);
+ int c = hdr[0] & 0xff;
+ long size = c & 15;
+ int shift = 4;
+ int p = 1;
+ while ((c & 0x80) != 0) {
+ c = hdr[p++] & 0xff;
+ size += ((long) (c & 0x7f)) << shift;
+ shift += 7;
+ }
+ return size;
} catch (ZipException badStream) {
throw new CorruptObjectException(id,
JGitText.get().corruptObjectBadStream);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java
index ea0d269053..616447a651 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java
@@ -126,17 +126,19 @@ class UnpackedObjectCache {
for (int n = 0; n < MAX_CHAIN;) {
ObjectId obj = ids.get(i);
if (obj == null) {
- if (ids.compareAndSet(i, null, toAdd.copy()))
+ if (ids.compareAndSet(i, null, toAdd.copy())) {
return true;
- else
- continue;
+ }
+ continue;
}
- if (AnyObjectId.isEqual(obj, toAdd))
+ if (AnyObjectId.isEqual(obj, toAdd)) {
return true;
+ }
- if (++i == ids.length())
+ if (++i == ids.length()) {
i = 0;
+ }
n++;
}
return false;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/CachedPackUriProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/CachedPackUriProvider.java
index 5cbc2baeb2..9496d78c2f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/CachedPackUriProvider.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/CachedPackUriProvider.java
@@ -76,14 +76,22 @@ public interface CachedPackUriProvider {
private final String hash;
private final String uri;
+ private final long size;
+
/**
* Constructs an object containing information about a packfile.
- * @param hash the hash of the packfile as a hexadecimal string
- * @param uri the URI corresponding to the packfile
+ *
+ * @param hash
+ * the hash of the packfile as a hexadecimal string
+ * @param uri
+ * the URI corresponding to the packfile
+ * @param size
+ * the size of the packfile in bytes
*/
- public PackInfo(String hash, String uri) {
+ public PackInfo(String hash, String uri, long size) {
this.hash = hash;
this.uri = uri;
+ this.size = size;
}
/**
@@ -99,5 +107,12 @@ public interface CachedPackUriProvider {
public String getUri() {
return uri;
}
+
+ /**
+ * @return the size of the packfile in bytes (-1 if unknown)
+ */
+ public long getSize() {
+ return size;
+ }
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
index 43067d364d..e4536643a7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
@@ -1230,6 +1230,8 @@ public class PackWriter implements AutoCloseable {
if (packInfo != null) {
o.writeString(packInfo.getHash() + ' ' +
packInfo.getUri() + '\n');
+ stats.offloadedPackfiles += 1;
+ stats.offloadedPackfileSize += packInfo.getSize();
} else {
unwrittenCachedPacks.add(pack);
}
@@ -1749,23 +1751,23 @@ public class PackWriter implements AutoCloseable {
NullProgressMonitor.INSTANCE,
Collections.singleton(otp));
continue;
- } else {
- // Object writing already started, we cannot recover.
- //
- CorruptObjectException coe;
- coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$
- coe.initCause(gone);
- throw coe;
}
+ // Object writing already started, we cannot recover.
+ //
+ CorruptObjectException coe;
+ coe = new CorruptObjectException(otp, ""); //$NON-NLS-1$
+ coe.initCause(gone);
+ throw coe;
}
}
// If we reached here, reuse wasn't possible.
//
- if (otp.isDeltaRepresentation())
+ if (otp.isDeltaRepresentation()) {
writeDeltaObjectDeflate(out, otp);
- else
+ } else {
writeWholeObjectDeflate(out, otp);
+ }
out.endObject();
otp.setCRC((int) crc32.getValue());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
index c740bf2c37..4de5e392f9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/MergedReftable.java
@@ -67,13 +67,11 @@ import org.eclipse.jgit.lib.ReflogEntry;
* A {@code MergedReftable} is not thread-safe.
*/
public class MergedReftable extends Reftable {
- private final Reftable[] tables;
+ private final ReftableReader[] tables;
/**
* Initialize a merged table reader.
* <p>
- * The tables in {@code tableStack} will be closed when this
- * {@code MergedReftable} is closed.
*
* @param tableStack
* stack of tables to read from. The base of the stack is at
@@ -81,16 +79,25 @@ public class MergedReftable extends Reftable {
* {@code tableStack.size() - 1}. The top of the stack (higher
* index) shadows the base of the stack (lower index).
*/
- public MergedReftable(List<Reftable> tableStack) {
- tables = tableStack.toArray(new Reftable[0]);
+ public MergedReftable(List<ReftableReader> tableStack) {
+ tables = tableStack.toArray(new ReftableReader[0]);
// Tables must expose deletes to this instance to correctly
// shadow references from lower tables.
- for (Reftable t : tables) {
+ for (ReftableReader t : tables) {
t.setIncludeDeletes(true);
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public long maxUpdateIndex() throws IOException {
+ return tables.length > 0 ? tables[tables.length - 1].maxUpdateIndex()
+ : 0;
+ }
+
/** {@inheritDoc} */
@Override
public RefCursor allRefs() throws IOException {
@@ -124,7 +131,7 @@ public class MergedReftable extends Reftable {
/** {@inheritDoc} */
@Override
public RefCursor byObjectId(AnyObjectId name) throws IOException {
- MergedRefCursor m = new MergedRefCursor();
+ MergedRefCursor m = new FilteringMergedRefCursor(name);
for (int i = 0; i < tables.length; i++) {
m.add(new RefQueueEntry(tables[i].byObjectId(name), i));
}
@@ -152,14 +159,6 @@ public class MergedReftable extends Reftable {
return m;
}
- /** {@inheritDoc} */
- @Override
- public void close() throws IOException {
- for (Reftable t : tables) {
- t.close();
- }
- }
-
int queueSize() {
return Math.max(1, tables.length);
}
@@ -251,6 +250,42 @@ public class MergedReftable extends Reftable {
}
}
+ private class FilteringMergedRefCursor extends MergedRefCursor {
+ final AnyObjectId filterId;
+ Ref filteredRef;
+
+ FilteringMergedRefCursor(AnyObjectId id) {
+ filterId = id;
+ filteredRef = null;
+ }
+
+ @Override
+ public Ref getRef() {
+ return filteredRef;
+ }
+
+ @Override
+ public boolean next() throws IOException {
+ for (;;) {
+ boolean ok = super.next();
+ if (!ok) {
+ return false;
+ }
+
+ String name = super.getRef().getName();
+
+ try (RefCursor c = seekRef(name)) {
+ if (c.next()) {
+ if (filterId.equals(c.getRef().getObjectId())) {
+ filteredRef = c.getRef();
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+
private static class RefQueueEntry {
static int compare(RefQueueEntry a, RefQueueEntry b) {
int cmp = a.name().compareTo(b.name());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
index cb02628e8d..8f64261766 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/Reftable.java
@@ -58,7 +58,7 @@ import org.eclipse.jgit.lib.SymbolicRef;
/**
* Abstract table of references.
*/
-public abstract class Reftable implements AutoCloseable {
+public abstract class Reftable {
/**
* References to convert into a reftable
*
@@ -72,9 +72,9 @@ public abstract class Reftable implements AutoCloseable {
cfg.setIndexObjects(false);
cfg.setAlignBlocks(false);
ByteArrayOutputStream buf = new ByteArrayOutputStream();
- new ReftableWriter()
+ new ReftableWriter(buf)
.setConfig(cfg)
- .begin(buf)
+ .begin()
.sortAndWriteRefs(refs)
.finish();
return new ReftableReader(BlockSource.from(buf.toByteArray()));
@@ -98,6 +98,19 @@ public abstract class Reftable implements AutoCloseable {
includeDeletes = deletes;
}
+
+ /**
+ * Get the maximum update index for log entries that appear in this
+ * reftable.
+ *
+ * @return the maximum update index for log entries that appear in this
+ * reftable. This should be 1 higher than the prior reftable's
+ * {@code maxUpdateIndex} if this table is used in a stack.
+ * @throws java.io.IOException
+ * file cannot be read.
+ */
+ public abstract long maxUpdateIndex() throws IOException;
+
/**
* Seek to the first reference, to iterate in order.
*
@@ -282,8 +295,4 @@ public abstract class Reftable implements AutoCloseable {
}
return new SymbolicRef(ref.getName(), dst, ref.getUpdateIndex());
}
-
- /** {@inheritDoc} */
- @Override
- public abstract void close() throws IOException;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableBatchRefUpdate.java
index 07fd00f149..592120d89b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/ReftableBatchRefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableBatchRefUpdate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2017, Google Inc.
+ * Copyright (C) 2019, Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -41,40 +41,11 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-package org.eclipse.jgit.internal.storage.dfs;
-
-import static org.eclipse.jgit.internal.storage.pack.PackExt.REFTABLE;
-import static org.eclipse.jgit.lib.Ref.Storage.NEW;
-import static org.eclipse.jgit.lib.Ref.Storage.PACKED;
-import static org.eclipse.jgit.transport.ReceiveCommand.Result.LOCK_FAILURE;
-import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED;
-import static org.eclipse.jgit.transport.ReceiveCommand.Result.OK;
-import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_MISSING_OBJECT;
-import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_NONFASTFORWARD;
-import static org.eclipse.jgit.transport.ReceiveCommand.Type.UPDATE_NONFASTFORWARD;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.locks.ReentrantLock;
+package org.eclipse.jgit.internal.storage.reftable;
import org.eclipse.jgit.annotations.Nullable;
import org.eclipse.jgit.errors.MissingObjectException;
-import org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource;
-import org.eclipse.jgit.internal.storage.io.BlockSource;
-import org.eclipse.jgit.internal.storage.pack.PackExt;
-import org.eclipse.jgit.internal.storage.reftable.Reftable;
-import org.eclipse.jgit.internal.storage.reftable.ReftableCompactor;
-import org.eclipse.jgit.internal.storage.reftable.ReftableConfig;
-import org.eclipse.jgit.internal.storage.reftable.ReftableReader;
-import org.eclipse.jgit.internal.storage.reftable.ReftableWriter;
+import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.BatchRefUpdate;
import org.eclipse.jgit.lib.ObjectId;
@@ -82,43 +53,65 @@ import org.eclipse.jgit.lib.ObjectIdRef;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.ReflogEntry;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.SymbolicRef;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.transport.ReceiveCommand;
-/**
- * {@link org.eclipse.jgit.lib.BatchRefUpdate} for
- * {@link org.eclipse.jgit.internal.storage.dfs.DfsReftableDatabase}.
- */
-public class ReftableBatchRefUpdate extends BatchRefUpdate {
- private static final int AVG_BYTES = 36;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.locks.Lock;
+import java.util.stream.Collectors;
+
+import static org.eclipse.jgit.lib.Ref.Storage.NEW;
+import static org.eclipse.jgit.lib.Ref.Storage.PACKED;
- private final DfsReftableDatabase refdb;
+import static org.eclipse.jgit.transport.ReceiveCommand.Result.LOCK_FAILURE;
+import static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED;
+import static org.eclipse.jgit.transport.ReceiveCommand.Result.OK;
+import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_MISSING_OBJECT;
+import static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_NONFASTFORWARD;
+import static org.eclipse.jgit.transport.ReceiveCommand.Type.DELETE;
+import static org.eclipse.jgit.transport.ReceiveCommand.Type.UPDATE_NONFASTFORWARD;
- private final DfsObjDatabase odb;
+/**
+ * {@link org.eclipse.jgit.lib.BatchRefUpdate} for Reftable based RefDatabase.
+ */
+public abstract class ReftableBatchRefUpdate extends BatchRefUpdate {
+ private final Lock lock;
- private final ReentrantLock lock;
+ private final ReftableDatabase refDb;
- private final ReftableConfig reftableConfig;
+ private final Repository repository;
/**
- * Initialize batch update.
+ * Initialize.
*
* @param refdb
- * database the update will modify.
- * @param odb
- * object database to store the reftable.
+ * The RefDatabase
+ * @param reftableDb
+ * The ReftableDatabase
+ * @param lock
+ * A lock protecting the refdatabase's state
+ * @param repository
+ * The repository on which this update will run
*/
- protected ReftableBatchRefUpdate(DfsReftableDatabase refdb,
- DfsObjDatabase odb) {
+ protected ReftableBatchRefUpdate(RefDatabase refdb, ReftableDatabase reftableDb, Lock lock,
+ Repository repository) {
super(refdb);
- this.refdb = refdb;
- this.odb = odb;
- lock = refdb.getLock();
- reftableConfig = refdb.getReftableConfig();
+ this.refDb = reftableDb;
+ this.lock = lock;
+ this.repository = repository;
}
/** {@inheritDoc} */
@@ -135,25 +128,36 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
if (!checkObjectExistence(rw, pending)) {
return;
}
+ // if we are here, checkObjectExistence might have flagged some problems
+ // but the transaction is not atomic, so we should proceed with the other
+ // pending commands.
+ pending = getPending();
if (!checkNonFastForwards(rw, pending)) {
return;
}
+ pending = getPending();
lock.lock();
try {
- Reftable table = refdb.reader();
- if (!checkExpected(table, pending)) {
+ if (!checkExpected(pending)) {
return;
}
+ pending = getPending();
if (!checkConflicting(pending)) {
return;
}
+ pending = getPending();
if (!blockUntilTimestamps(MAX_WAIT)) {
return;
}
- applyUpdates(rw, pending);
+
+ List<Ref> newRefs = toNewRefs(rw, pending);
+ applyUpdates(newRefs, pending);
for (ReceiveCommand cmd : pending) {
- cmd.setResult(OK);
+ if (cmd.getResult() == NOT_ATTEMPTED) {
+ // XXX this is a bug in DFS ?
+ cmd.setResult(OK);
+ }
}
} finally {
lock.unlock();
@@ -164,6 +168,19 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
}
}
+ /**
+ * Implements the storage-specific part of the update.
+ *
+ * @param newRefs
+ * the new refs to create
+ * @param pending
+ * the pending receive commands to be executed
+ * @throws IOException
+ * if any of the writes fail.
+ */
+ protected abstract void applyUpdates(List<Ref> newRefs,
+ List<ReceiveCommand> pending) throws IOException;
+
private List<ReceiveCommand> getPending() {
return ReceiveCommand.filter(getCommands(), NOT_ATTEMPTED);
}
@@ -181,8 +198,10 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
// used for a missing object. Eagerly handle this case so we
// can set the right result.
cmd.setResult(REJECTED_MISSING_OBJECT);
- ReceiveCommand.abort(pending);
- return false;
+ if (isAtomic()) {
+ ReceiveCommand.abort(pending);
+ return false;
+ }
}
}
return true;
@@ -197,8 +216,10 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
cmd.updateType(rw);
if (cmd.getType() == UPDATE_NONFASTFORWARD) {
cmd.setResult(REJECTED_NONFASTFORWARD);
- ReceiveCommand.abort(pending);
- return false;
+ if (isAtomic()) {
+ ReceiveCommand.abort(pending);
+ return false;
+ }
}
}
return true;
@@ -206,40 +227,55 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
private boolean checkConflicting(List<ReceiveCommand> pending)
throws IOException {
- Set<String> names = new HashSet<>();
- for (ReceiveCommand cmd : pending) {
- names.add(cmd.getRefName());
- }
+ TreeSet<String> added = new TreeSet<>();
+ Set<String> deleted =
+ pending.stream()
+ .filter(cmd -> cmd.getType() == DELETE)
+ .map(c -> c.getRefName())
+ .collect(Collectors.toSet());
boolean ok = true;
for (ReceiveCommand cmd : pending) {
+ if (cmd.getType() == DELETE) {
+ continue;
+ }
+
String name = cmd.getRefName();
- if (refdb.isNameConflicting(name)) {
- cmd.setResult(LOCK_FAILURE);
- ok = false;
- } else {
- int s = name.lastIndexOf('/');
- while (0 < s) {
- if (names.contains(name.substring(0, s))) {
- cmd.setResult(LOCK_FAILURE);
- ok = false;
- break;
- }
- s = name.lastIndexOf('/', s - 1);
+ if (refDb.isNameConflicting(name, added, deleted)) {
+ if (isAtomic()) {
+ cmd.setResult(
+ ReceiveCommand.Result.REJECTED_OTHER_REASON, JGitText.get().transactionAborted);
+ } else {
+ cmd.setResult(LOCK_FAILURE);
}
+
+ ok = false;
}
+ added.add(name);
}
- if (!ok && isAtomic()) {
- ReceiveCommand.abort(pending);
- return false;
+
+ if (isAtomic()) {
+ if (!ok) {
+ pending.stream()
+ .filter(cmd -> cmd.getResult() == NOT_ATTEMPTED)
+ .forEach(cmd -> cmd.setResult(LOCK_FAILURE));
+ }
+ return ok;
}
- return ok;
+
+ for (ReceiveCommand cmd : pending) {
+ if (cmd.getResult() == NOT_ATTEMPTED) {
+ return true;
+ }
+ }
+
+ return false;
}
- private boolean checkExpected(Reftable table, List<ReceiveCommand> pending)
+ private boolean checkExpected(List<ReceiveCommand> pending)
throws IOException {
for (ReceiveCommand cmd : pending) {
- if (!matchOld(cmd, table.exactRef(cmd.getRefName()))) {
+ if (!matchOld(cmd, refDb.exactRef(cmd.getRefName()))) {
cmd.setResult(LOCK_FAILURE);
if (isAtomic()) {
ReceiveCommand.abort(pending);
@@ -253,7 +289,7 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
private static boolean matchOld(ReceiveCommand cmd, @Nullable Ref ref) {
if (ref == null) {
return AnyObjectId.isEqual(ObjectId.zeroId(), cmd.getOldId())
- && cmd.getOldSymref() == null;
+ && cmd.getOldSymref() == null;
} else if (ref.isSymbolic()) {
return ref.getTarget().getName().equals(cmd.getOldSymref());
}
@@ -264,47 +300,26 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
return cmd.getOldId().equals(id);
}
- private void applyUpdates(RevWalk rw, List<ReceiveCommand> pending)
- throws IOException {
- List<Ref> newRefs = toNewRefs(rw, pending);
- long updateIndex = nextUpdateIndex();
- Set<DfsPackDescription> prune = Collections.emptySet();
- DfsPackDescription pack = odb.newPack(PackSource.INSERT);
- try (DfsOutputStream out = odb.writeFile(pack, REFTABLE)) {
- ReftableConfig cfg = DfsPackCompactor
- .configureReftable(reftableConfig, out);
-
- ReftableWriter.Stats stats;
- if (refdb.compactDuringCommit()
- && newRefs.size() * AVG_BYTES <= cfg.getRefBlockSize()
- && canCompactTopOfStack(cfg)) {
- ByteArrayOutputStream tmp = new ByteArrayOutputStream();
- write(tmp, cfg, updateIndex, newRefs, pending);
- stats = compactTopOfStack(out, cfg, tmp.toByteArray());
- prune = toPruneTopOfStack();
- } else {
- stats = write(out, cfg, updateIndex, newRefs, pending);
- }
- pack.addFileExt(REFTABLE);
- pack.setReftableStats(stats);
- }
-
- odb.commitPack(Collections.singleton(pack), prune);
- odb.addReftable(pack, prune);
- refdb.clearCache();
- }
-
- private ReftableWriter.Stats write(OutputStream os, ReftableConfig cfg,
- long updateIndex, List<Ref> newRefs, List<ReceiveCommand> pending)
- throws IOException {
- ReftableWriter writer = new ReftableWriter(cfg)
- .setMinUpdateIndex(updateIndex).setMaxUpdateIndex(updateIndex)
- .begin(os).sortAndWriteRefs(newRefs);
+ /**
+ * Writes the refs to the writer, and calls finish.
+ *
+ * @param writer
+ * the writer on which we should write.
+ * @param newRefs
+ * the ref data to write..
+ * @param pending
+ * the log data to write.
+ * @throws IOException
+ * in case of problems.
+ */
+ protected void write(ReftableWriter writer, List<Ref> newRefs,
+ List<ReceiveCommand> pending) throws IOException {
+ long updateIndex = refDb.nextUpdateIndex();
+ writer.setMinUpdateIndex(updateIndex).setMaxUpdateIndex(updateIndex)
+ .begin().sortAndWriteRefs(newRefs);
if (!isRefLogDisabled()) {
writeLog(writer, updateIndex, pending);
}
- writer.finish();
- return writer.getStats();
}
private void writeLog(ReftableWriter writer, long updateIndex,
@@ -319,7 +334,7 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
PersonIdent ident = getRefLogIdent();
if (ident == null) {
- ident = new PersonIdent(refdb.getRepository());
+ ident = new PersonIdent(repository);
}
for (String name : byName) {
ReceiveCommand cmd = cmds.get(name);
@@ -361,20 +376,25 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
}
}
+ // Extracts and peels the refs out of the ReceiveCommands
private static List<Ref> toNewRefs(RevWalk rw, List<ReceiveCommand> pending)
- throws IOException {
+ throws IOException {
List<Ref> refs = new ArrayList<>(pending.size());
for (ReceiveCommand cmd : pending) {
+ if (cmd.getResult() != NOT_ATTEMPTED) {
+ continue;
+ }
+
String name = cmd.getRefName();
ObjectId newId = cmd.getNewId();
String newSymref = cmd.getNewSymref();
if (AnyObjectId.isEqual(ObjectId.zeroId(), newId)
- && newSymref == null) {
+ && newSymref == null) {
refs.add(new ObjectIdRef.Unpeeled(NEW, name, null));
continue;
} else if (newSymref != null) {
refs.add(new SymbolicRef(name,
- new ObjectIdRef.Unpeeled(NEW, newSymref, null)));
+ new ObjectIdRef.Unpeeled(NEW, newSymref, null)));
continue;
}
@@ -385,76 +405,11 @@ public class ReftableBatchRefUpdate extends BatchRefUpdate {
}
if (peel != null) {
refs.add(new ObjectIdRef.PeeledTag(PACKED, name, newId,
- peel.copy()));
+ peel.copy()));
} else {
refs.add(new ObjectIdRef.PeeledNonTag(PACKED, name, newId));
}
}
return refs;
}
-
- private long nextUpdateIndex() throws IOException {
- long updateIndex = 0;
- for (Reftable r : refdb.stack().readers()) {
- if (r instanceof ReftableReader) {
- updateIndex = Math.max(updateIndex,
- ((ReftableReader) r).maxUpdateIndex());
- }
- }
- return updateIndex + 1;
- }
-
- private boolean canCompactTopOfStack(ReftableConfig cfg)
- throws IOException {
- ReftableStack stack = refdb.stack();
- List<Reftable> readers = stack.readers();
- if (readers.isEmpty()) {
- return false;
- }
-
- int lastIdx = readers.size() - 1;
- DfsReftable last = stack.files().get(lastIdx);
- DfsPackDescription desc = last.getPackDescription();
- if (desc.getPackSource() != PackSource.INSERT
- || !packOnlyContainsReftable(desc)) {
- return false;
- }
-
- Reftable table = readers.get(lastIdx);
- int bs = cfg.getRefBlockSize();
- return table instanceof ReftableReader
- && ((ReftableReader) table).size() <= 3 * bs;
- }
-
- private ReftableWriter.Stats compactTopOfStack(OutputStream out,
- ReftableConfig cfg, byte[] newTable) throws IOException {
- List<Reftable> stack = refdb.stack().readers();
- Reftable last = stack.get(stack.size() - 1);
-
- List<Reftable> tables = new ArrayList<>(2);
- tables.add(last);
- tables.add(new ReftableReader(BlockSource.from(newTable)));
-
- ReftableCompactor compactor = new ReftableCompactor();
- compactor.setConfig(cfg);
- compactor.setIncludeDeletes(true);
- compactor.addAll(tables);
- compactor.compact(out);
- return compactor.getStats();
- }
-
- private Set<DfsPackDescription> toPruneTopOfStack() throws IOException {
- List<DfsReftable> stack = refdb.stack().files();
- DfsReftable last = stack.get(stack.size() - 1);
- return Collections.singleton(last.getPackDescription());
- }
-
- private boolean packOnlyContainsReftable(DfsPackDescription desc) {
- for (PackExt ext : PackExt.values()) {
- if (ext != REFTABLE && desc.hasFileExt(ext)) {
- return false;
- }
- }
- return true;
- }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
index c4e8f69fa4..c73c245be5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableCompactor.java
@@ -68,8 +68,8 @@ import org.eclipse.jgit.lib.ReflogEntry;
* {@code setOldestReflogTimeMillis(Long.MAX_VALUE)}.
*/
public class ReftableCompactor {
- private final ReftableWriter writer = new ReftableWriter();
- private final ArrayDeque<Reftable> tables = new ArrayDeque<>();
+ private final ReftableWriter writer;
+ private final ArrayDeque<ReftableReader> tables = new ArrayDeque<>();
private long compactBytesLimit;
private long bytesToCompact;
@@ -80,6 +80,17 @@ public class ReftableCompactor {
private Stats stats;
/**
+ * Creates a new compactor.
+ *
+ * @param out
+ * stream to write the compacted tables to. Caller is responsible
+ * for closing {@code out}.
+ */
+ public ReftableCompactor(OutputStream out) {
+ writer = new ReftableWriter(out);
+ }
+
+ /**
* Set configuration for the reftable.
*
* @param cfg
@@ -177,12 +188,10 @@ public class ReftableCompactor {
* @throws java.io.IOException
* update indexes of a reader cannot be accessed.
*/
- public void addAll(List<? extends Reftable> readers) throws IOException {
- tables.addAll(readers);
- for (Reftable r : readers) {
- if (r instanceof ReftableReader) {
- adjustUpdateIndexes((ReftableReader) r);
- }
+ public void addAll(List<ReftableReader> readers) throws IOException {
+ for (ReftableReader r : readers) {
+ tables.add(r);
+ adjustUpdateIndexes(r);
}
}
@@ -225,19 +234,16 @@ public class ReftableCompactor {
/**
* Write a compaction to {@code out}.
*
- * @param out
- * stream to write the compacted tables to. Caller is responsible
- * for closing {@code out}.
* @throws java.io.IOException
* if tables cannot be read, or cannot be written.
*/
- public void compact(OutputStream out) throws IOException {
+ public void compact() throws IOException {
MergedReftable mr = new MergedReftable(new ArrayList<>(tables));
mr.setIncludeDeletes(includeDeletes);
writer.setMinUpdateIndex(Math.max(minUpdateIndex, 0));
writer.setMaxUpdateIndex(maxUpdateIndex);
- writer.begin(out);
+ writer.begin();
mergeRefs(mr);
mergeLogs(mr);
writer.finish();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java
new file mode 100644
index 0000000000..2753c02800
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableDatabase.java
@@ -0,0 +1,294 @@
+package org.eclipse.jgit.internal.storage.reftable;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.jgit.annotations.Nullable;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Ref;
+import org.eclipse.jgit.lib.RefDatabase;
+import org.eclipse.jgit.lib.ReflogReader;
+import org.eclipse.jgit.transport.ReceiveCommand;
+
+/**
+ * Operations on {@link MergedReftable} that is common to various reftable-using
+ * subclasses of {@link RefDatabase}. See
+ * {@link org.eclipse.jgit.internal.storage.dfs.DfsReftableDatabase} for an
+ * example.
+ */
+public abstract class ReftableDatabase {
+ // Protects mergedTables.
+ private final ReentrantLock lock = new ReentrantLock(true);
+
+ private Reftable mergedTables;
+
+ /**
+ * ReftableDatabase lazily initializes its merged reftable on the first read after
+ * construction or clearCache() call. This function should always instantiate a new
+ * MergedReftable based on the list of reftables specified by the underlying storage.
+ *
+ * @return the ReftableStack for this instance
+ * @throws IOException
+ * on I/O problems.
+ */
+ abstract protected MergedReftable openMergedReftable() throws IOException;
+
+ /**
+ * @return the next available logical timestamp for an additional reftable
+ * in the stack.
+ * @throws java.io.IOException
+ * on I/O problems.
+ */
+ public long nextUpdateIndex() throws IOException {
+ lock.lock();
+ try {
+ return reader().maxUpdateIndex() + 1;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @return a ReflogReader for the given ref
+ * @param refname
+ * the name of the ref.
+ * @throws IOException
+ * on I/O problems
+ */
+ public ReflogReader getReflogReader(String refname) throws IOException {
+ lock.lock();
+ try {
+ return new ReftableReflogReader(lock, reader(), refname);
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * @return a ReceiveCommand for the change from oldRef to newRef
+ * @param oldRef
+ * a ref
+ * @param newRef
+ * a ref
+ */
+ public static ReceiveCommand toCommand(Ref oldRef, Ref newRef) {
+ ObjectId oldId = toId(oldRef);
+ ObjectId newId = toId(newRef);
+ String name = oldRef != null ? oldRef.getName() : newRef.getName();
+
+ if (oldRef != null && oldRef.isSymbolic()) {
+ if (newRef != null) {
+ if (newRef.isSymbolic()) {
+ return ReceiveCommand.link(oldRef.getTarget().getName(),
+ newRef.getTarget().getName(), name);
+ }
+ // This should pass in oldId for compat with
+ // RefDirectoryUpdate
+ return ReceiveCommand.unlink(oldRef.getTarget().getName(),
+ newId, name);
+ }
+ return ReceiveCommand.unlink(oldRef.getTarget().getName(),
+ ObjectId.zeroId(), name);
+ }
+
+ if (newRef != null && newRef.isSymbolic()) {
+ if (oldRef != null) {
+ if (oldRef.isSymbolic()) {
+ return ReceiveCommand.link(oldRef.getTarget().getName(),
+ newRef.getTarget().getName(), name);
+ }
+ return ReceiveCommand.link(oldId,
+ newRef.getTarget().getName(), name);
+ }
+ return ReceiveCommand.link(ObjectId.zeroId(),
+ newRef.getTarget().getName(), name);
+ }
+
+ return new ReceiveCommand(oldId, newId, name);
+ }
+
+ private static ObjectId toId(Ref ref) {
+ if (ref != null) {
+ ObjectId id = ref.getObjectId();
+ if (id != null) {
+ return id;
+ }
+ }
+ return ObjectId.zeroId();
+ }
+
+ /**
+ * @return the lock protecting underlying ReftableReaders against concurrent
+ * reads.
+ */
+ public ReentrantLock getLock() {
+ return lock;
+ }
+
+ /**
+ * @return the merged reftable that is implemented by the stack of
+ * reftables. Return value must be accessed under lock.
+ * @throws IOException
+ * on I/O problems
+ */
+ private Reftable reader() throws IOException {
+ if (!lock.isLocked()) {
+ throw new IllegalStateException(
+ "must hold lock to access merged table"); //$NON-NLS-1$
+ }
+ if (mergedTables == null) {
+ mergedTables = openMergedReftable();
+ }
+ return mergedTables;
+ }
+
+ /**
+ * @return whether the given refName would be illegal in a repository that
+ * uses loose refs.
+ * @param refName
+ * the name to check
+ * @param added
+ * a sorted set of refs we pretend have been added to the
+ * database.
+ * @param deleted
+ * a set of refs we pretend have been removed from the database.
+ * @throws IOException
+ * on I/O problems
+ */
+ public boolean isNameConflicting(String refName, TreeSet<String> added,
+ Set<String> deleted) throws IOException {
+ lock.lock();
+ try {
+ Reftable table = reader();
+
+ // Cannot be nested within an existing reference.
+ int lastSlash = refName.lastIndexOf('/');
+ while (0 < lastSlash) {
+ String prefix = refName.substring(0, lastSlash);
+ if (!deleted.contains(prefix)
+ && (table.hasRef(prefix) || added.contains(prefix))) {
+ return true;
+ }
+ lastSlash = refName.lastIndexOf('/', lastSlash - 1);
+ }
+
+ // Cannot be the container of an existing reference.
+ String prefix = refName + '/';
+ RefCursor c = table.seekRefsWithPrefix(prefix);
+ while (c.next()) {
+ if (!deleted.contains(c.getRef().getName())) {
+ return true;
+ }
+ }
+
+ String it = added.ceiling(refName + '/');
+ if (it != null && it.startsWith(prefix)) {
+ return true;
+ }
+ return false;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Read a single reference.
+ * <p>
+ * This method expects an unshortened reference name and does not search
+ * using the standard search path.
+ *
+ * @param name
+ * the unabbreviated name of the reference.
+ * @return the reference (if it exists); else {@code null}.
+ * @throws java.io.IOException
+ * the reference space cannot be accessed.
+ */
+ @Nullable
+ public Ref exactRef(String name) throws IOException {
+ lock.lock();
+ try {
+ Reftable table = reader();
+ Ref ref = table.exactRef(name);
+ if (ref != null && ref.isSymbolic()) {
+ return table.resolve(ref);
+ }
+ return ref;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Returns refs whose names start with a given prefix.
+ *
+ * @param prefix
+ * string that names of refs should start with; may be empty (to
+ * return all refs).
+ * @return immutable list of refs whose names start with {@code prefix}.
+ * @throws java.io.IOException
+ * the reference space cannot be accessed.
+ */
+ public List<Ref> getRefsByPrefix(String prefix) throws IOException {
+ List<Ref> all = new ArrayList<>();
+ lock.lock();
+ try {
+ Reftable table = reader();
+ try (RefCursor rc = RefDatabase.ALL.equals(prefix) ? table.allRefs()
+ : table.seekRefsWithPrefix(prefix)) {
+ while (rc.next()) {
+ Ref ref = table.resolve(rc.getRef());
+ if (ref != null && ref.getObjectId() != null) {
+ all.add(ref);
+ }
+ }
+ }
+ } finally {
+ lock.unlock();
+ }
+
+ return Collections.unmodifiableList(all);
+ }
+
+ /**
+ * Returns all refs that resolve directly to the given {@link ObjectId}.
+ * Includes peeled {@linkObjectId}s.
+ *
+ * @param id
+ * {@link ObjectId} to resolve
+ * @return a {@link Set} of {@link Ref}s whose tips point to the provided
+ * id.
+ * @throws java.io.IOException
+ * on I/O errors.
+ */
+ public Set<Ref> getTipsWithSha1(ObjectId id) throws IOException {
+ lock.lock();
+ try {
+ RefCursor cursor = reader().byObjectId(id);
+ Set<Ref> refs = new HashSet<>();
+ while (cursor.next()) {
+ refs.add(cursor.getRef());
+ }
+ return refs;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /**
+ * Drops all data that might be cached in memory.
+ */
+ public void clearCache() {
+ lock.lock();
+ try {
+ mergedTables = null;
+ } finally {
+ lock.unlock();
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
index 4f0ff2d1d1..c5e667449a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReader.java
@@ -78,7 +78,7 @@ import org.eclipse.jgit.util.NB;
* {@code ReftableReader} is not thread-safe. Concurrent readers need their own
* instance to read from the same file.
*/
-public class ReftableReader extends Reftable {
+public class ReftableReader extends Reftable implements AutoCloseable {
private final BlockSource src;
private int blockSize = -1;
@@ -146,15 +146,9 @@ public class ReftableReader extends Reftable {
}
/**
- * Get the maximum update index for log entries that appear in this
- * reftable.
- *
- * @return the maximum update index for log entries that appear in this
- * reftable. This should be 1 higher than the prior reftable's
- * {@code maxUpdateIndex} if this table is used in a stack.
- * @throws java.io.IOException
- * file cannot be read.
+ * {@inheritDoc}
*/
+ @Override
public long maxUpdateIndex() throws IOException {
if (blockSize == -1) {
readFileHeader();
@@ -169,11 +163,13 @@ public class ReftableReader extends Reftable {
readFileHeader();
}
- long end = refEnd > 0 ? refEnd : (src.size() - FILE_FOOTER_LEN);
- src.adviseSequentialRead(0, end);
+ if (refEnd == 0) {
+ readFileFooter();
+ }
+ src.adviseSequentialRead(0, refEnd);
- RefCursorImpl i = new RefCursorImpl(end, null, false);
- i.block = readBlock(0, end);
+ RefCursorImpl i = new RefCursorImpl(refEnd, null, false);
+ i.block = readBlock(0, refEnd);
return i;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReflogReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReflogReader.java
new file mode 100644
index 0000000000..c75d3cfa55
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableReflogReader.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2019, Google LLC
+ * 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.internal.storage.reftable;
+
+import org.eclipse.jgit.lib.ReflogEntry;
+import org.eclipse.jgit.lib.ReflogReader;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Implement the ReflogReader interface for a reflog stored in reftable.
+ */
+public class ReftableReflogReader implements ReflogReader {
+ private final Lock lock;
+
+ private final Reftable reftable;
+
+ private final String refname;
+
+ ReftableReflogReader(Lock lock, Reftable merged, String refname) {
+ this.lock = lock;
+ this.reftable = merged;
+ this.refname = refname;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public ReflogEntry getLastEntry() throws IOException {
+ lock.lock();
+ try {
+ LogCursor cursor = reftable.seekLog(refname);
+ return cursor.next() ? cursor.getReflogEntry() : null;
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public List<ReflogEntry> getReverseEntries() throws IOException {
+ return getReverseEntries(Integer.MAX_VALUE);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public ReflogEntry getReverseEntry(int number) throws IOException {
+ lock.lock();
+ try {
+ LogCursor cursor = reftable.seekLog(refname);
+ while (true) {
+ if (!cursor.next() || number < 0) {
+ return null;
+ }
+ if (number == 0) {
+ return cursor.getReflogEntry();
+ }
+ number--;
+ }
+ } finally {
+ lock.unlock();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public List<ReflogEntry> getReverseEntries(int max) throws IOException {
+ lock.lock();
+ try {
+ LogCursor cursor = reftable.seekLog(refname);
+
+ List<ReflogEntry> result = new ArrayList<>();
+ while (cursor.next() && result.size() < max) {
+ result.add(cursor.getReflogEntry());
+ }
+
+ return result;
+ } finally {
+ lock.unlock();
+ }
+ }
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java
index 6459c2763d..d06fee3427 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftable/ReftableWriter.java
@@ -108,6 +108,7 @@ public class ReftableWriter {
private long minUpdateIndex;
private long maxUpdateIndex;
+ private OutputStream outputStream;
private ReftableOutputStream out;
private ObjectIdSubclassMap<RefList> obj2ref;
@@ -122,21 +123,27 @@ public class ReftableWriter {
/**
* Initialize a writer with a default configuration.
+ *
+ * @param os
+ * output stream.
*/
- public ReftableWriter() {
- this(new ReftableConfig());
+ public ReftableWriter(OutputStream os) {
+ this(new ReftableConfig(), os);
lastRef = null;
lastLog = null;
}
/**
- * Initialize a writer with a specific configuration.
+ * Initialize a writer with a configuration.
*
* @param cfg
- * configuration for the writer.
+ * configuration for the writer
+ * @param os
+ * output stream.
*/
- public ReftableWriter(ReftableConfig cfg) {
+ public ReftableWriter(ReftableConfig cfg, OutputStream os) {
config = cfg;
+ outputStream = os;
}
/**
@@ -183,16 +190,16 @@ public class ReftableWriter {
}
/**
- * Begin writing the reftable.
+ * Begin writing the reftable. Should be called only once. Call this
+ * if a stream was passed to the constructor.
*
- * @param os
- * stream to write the table to. Caller is responsible for
- * closing the stream after invoking {@link #finish()}.
* @return {@code this}
- * @throws java.io.IOException
- * if reftable header cannot be written.
*/
- public ReftableWriter begin(OutputStream os) throws IOException {
+ public ReftableWriter begin() {
+ if (out != null) {
+ throw new IllegalStateException("begin() called twice.");//$NON-NLS-1$
+ }
+
refBlockSize = config.getRefBlockSize();
logBlockSize = config.getLogBlockSize();
restartInterval = config.getRestartInterval();
@@ -212,7 +219,7 @@ public class ReftableWriter {
restartInterval = refBlockSize < (60 << 10) ? 16 : 64;
}
- out = new ReftableOutputStream(os, refBlockSize, alignBlocks);
+ out = new ReftableOutputStream(outputStream, refBlockSize, alignBlocks);
refs = new Section(REF_BLOCK_TYPE);
if (indexObjects) {
obj2ref = new ObjectIdSubclassMap<>();
@@ -223,6 +230,7 @@ public class ReftableWriter {
/**
* Sort a collection of references and write them to the reftable.
+ * The input refs may not have duplicate names.
*
* @param refsToPack
* references to sort and write.
@@ -236,10 +244,16 @@ public class ReftableWriter {
.map(r -> new RefEntry(r, maxUpdateIndex - minUpdateIndex))
.sorted(Entry::compare)
.iterator();
+ RefEntry last = null;
while (itr.hasNext()) {
RefEntry entry = itr.next();
+ if (last != null && Entry.compare(last, entry) == 0) {
+ throwIllegalEntry(last, entry);
+ }
+
long blockPos = refs.write(entry);
indexRef(entry.ref, blockPos);
+ last = entry;
}
return this;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java
index da98e3fadd..9c5423fb0e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/reftree/RefTreeBatch.java
@@ -102,9 +102,8 @@ class RefTreeBatch extends BatchRefUpdate {
if (isAtomic()) {
ReceiveCommand.abort(getCommands());
return;
- } else {
- continue;
}
+ continue;
}
}
todo.add(new Command(rw, c));
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileCache.java
index 882b2d055b..39a67afae3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/http/NetscapeCookieFileCache.java
@@ -82,9 +82,8 @@ public class NetscapeCookieFileCache {
public static NetscapeCookieFileCache getInstance(HttpConfig config) {
if (instance == null) {
return new NetscapeCookieFileCache(config);
- } else {
- return instance;
}
+ return instance;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
index c1e94a0a3e..ee6adeee98 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
@@ -384,9 +384,8 @@ public class OpenSshConfigFile {
private static boolean isHostMatch(String pattern, String name) {
if (pattern.startsWith("!")) { //$NON-NLS-1$
return !patternMatchesHost(pattern.substring(1), name);
- } else {
- return patternMatchesHost(pattern, name);
}
+ return patternMatchesHost(pattern, name);
}
private static boolean patternMatchesHost(String pattern, String name) {
@@ -399,10 +398,9 @@ public class OpenSshConfigFile {
}
fn.append(name);
return fn.isMatch();
- } else {
- // Not a pattern but a full host name
- return pattern.equals(name);
}
+ // Not a pattern but a full host name
+ return pattern.equals(name);
}
private static String dequote(String value) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
index 4f90e69008..24850ee44c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
@@ -302,10 +302,10 @@ public abstract class AnyObjectId implements Comparable<AnyObjectId> {
/** {@inheritDoc} */
@Override
public final boolean equals(Object o) {
- if (o instanceof AnyObjectId)
+ if (o instanceof AnyObjectId) {
return equals((AnyObjectId) o);
- else
- return false;
+ }
+ return false;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
index 96e50667b3..98a46f3e54 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java
@@ -103,25 +103,29 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
private static File getSymRef(File workTree, File dotGit, FS fs)
throws IOException {
byte[] content = IO.readFully(dotGit);
- if (!isSymRef(content))
+ if (!isSymRef(content)) {
throw new IOException(MessageFormat.format(
JGitText.get().invalidGitdirRef, dotGit.getAbsolutePath()));
+ }
int pathStart = 8;
int lineEnd = RawParseUtils.nextLF(content, pathStart);
while (content[lineEnd - 1] == '\n' ||
- (content[lineEnd - 1] == '\r' && SystemReader.getInstance().isWindows()))
+ (content[lineEnd - 1] == '\r'
+ && SystemReader.getInstance().isWindows())) {
lineEnd--;
- if (lineEnd == pathStart)
+ }
+ if (lineEnd == pathStart) {
throw new IOException(MessageFormat.format(
JGitText.get().invalidGitdirRef, dotGit.getAbsolutePath()));
+ }
String gitdirPath = RawParseUtils.decode(content, pathStart, lineEnd);
File gitdirFile = fs.resolve(workTree, gitdirPath);
- if (gitdirFile.isAbsolute())
+ if (gitdirFile.isAbsolute()) {
return gitdirFile;
- else
- return new File(workTree, gitdirPath).getCanonicalFile();
+ }
+ return new File(workTree, gitdirPath).getCanonicalFile();
}
private FS fs;
@@ -723,9 +727,8 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re
.getAbsolutePath(), err.getMessage()));
}
return cfg;
- } else {
- return new Config();
}
+ return new Config();
}
private File guessWorkTreeOrFail() throws IOException {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java
index be53c4b4f6..cad747bcff 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchConfig.java
@@ -232,9 +232,9 @@ public class BranchConfig {
private String getRemoteOrDefault() {
String remote = getRemote();
- if (remote == null)
+ if (remote == null) {
return Constants.DEFAULT_REMOTE_NAME;
- else
- return remote;
+ }
+ return remote;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
index 16db717032..938fa2394e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -1395,12 +1395,11 @@ public class Config {
}
trailingSpaces.append(cc);
continue;
- } else {
- inLeadingSpace = false;
- if (trailingSpaces != null) {
- value.append(trailingSpaces);
- trailingSpaces.setLength(0);
- }
+ }
+ inLeadingSpace = false;
+ if (trailingSpaces != null) {
+ value.append(trailingSpaces);
+ trailingSpaces.setLength(0);
}
if ('\\' == c) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 8f40db626a..f2f1d5a48f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -149,6 +149,12 @@ public final class ConfigConstants {
*/
public static final String CONFIG_KEY_GPGSIGN = "gpgSign";
+ /**
+ * The "hooksPath" key.
+ * @since 5.6
+ */
+ public static final String CONFIG_KEY_HOOKS_PATH = "hooksPath";
+
/** The "algorithm" key */
public static final String CONFIG_KEY_ALGORITHM = "algorithm";
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
index 98de3a91cc..cdfa949cad 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
@@ -79,40 +79,40 @@ public class CoreConfig {
* @since 4.3
*/
public static enum EOL {
- /** checkin with LF, checkout with CRLF. */
+ /** Check in with LF, check out with CRLF. */
CRLF,
- /** checkin with LF, checkout without conversion. */
+ /** Check in with LF, check out without conversion. */
LF,
- /** use the platform's native line ending. */
+ /** Use the platform's native line ending. */
NATIVE;
}
/**
- * EOL stream conversion protocol
+ * EOL stream conversion protocol.
*
* @since 4.3
*/
public static enum EolStreamType {
- /** convert to CRLF without binary detection */
+ /** Convert to CRLF without binary detection. */
TEXT_CRLF,
- /** convert to LF without binary detection */
+ /** Convert to LF without binary detection. */
TEXT_LF,
- /** convert to CRLF with binary detection */
+ /** Convert to CRLF with binary detection. */
AUTO_CRLF,
- /** convert to LF with binary detection */
+ /** Convert to LF with binary detection. */
AUTO_LF,
- /** do not convert */
+ /** Do not convert. */
DIRECT;
}
/**
- * Permissible values for {@code core.checkstat}
+ * Permissible values for {@code core.checkstat}.
*
* @since 3.0
*/
@@ -130,11 +130,30 @@ public class CoreConfig {
DEFAULT
}
+ /**
+ * Permissible values for {@code core.logAllRefUpdates}.
+ *
+ * @since 5.6
+ */
+ public static enum LogRefUpdates {
+ /** Don't create ref logs; default for bare repositories. */
+ FALSE,
+
+ /**
+ * Create ref logs for refs/heads/**, refs/remotes/**, refs/notes/**,
+ * and for HEAD. Default for non-bare repositories.
+ */
+ TRUE,
+
+ /** Create ref logs for all refs/** and for HEAD. */
+ ALWAYS
+ }
+
private final int compression;
private final int packIndexVersion;
- private final boolean logAllRefUpdates;
+ private final LogRefUpdates logAllRefUpdates;
private final String excludesfile;
@@ -146,23 +165,26 @@ public class CoreConfig {
* @since 3.3
*/
public static enum SymLinks {
- /** Checkout symbolic links as plain files */
+ /** Check out symbolic links as plain files . */
FALSE,
- /** Checkout symbolic links as links */
+
+ /** Check out symbolic links as links. */
TRUE
}
/**
- * Options for hiding files whose names start with a period
+ * Options for hiding files whose names start with a period.
*
* @since 3.5
*/
public static enum HideDotFiles {
- /** Do not hide .files */
+ /** Do not hide .files. */
FALSE,
- /** Hide add .files */
+
+ /** Hide add .files. */
TRUE,
- /** Hide only .git */
+
+ /** Hide only .git. */
DOTGITONLY
}
@@ -171,8 +193,9 @@ public class CoreConfig {
ConfigConstants.CONFIG_KEY_COMPRESSION, DEFAULT_COMPRESSION);
packIndexVersion = rc.getInt(ConfigConstants.CONFIG_PACK_SECTION,
ConfigConstants.CONFIG_KEY_INDEXVERSION, 2);
- logAllRefUpdates = rc.getBoolean(ConfigConstants.CONFIG_CORE_SECTION,
- ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true);
+ logAllRefUpdates = rc.getEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES,
+ LogRefUpdates.TRUE);
excludesfile = rc.getString(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_EXCLUDESFILE);
attributesfile = rc.getString(ConfigConstants.CONFIG_CORE_SECTION,
@@ -201,9 +224,14 @@ public class CoreConfig {
* Whether to log all refUpdates
*
* @return whether to log all refUpdates
+ * @deprecated since 5.6; default value depends on whether the repository is
+ * bare. Use
+ * {@link Config#getEnum(String, String, String, Enum)}
+ * directly.
*/
+ @Deprecated
public boolean isLogAllRefUpdates() {
- return logAllRefUpdates;
+ return !LogRefUpdates.FALSE.equals(logAllRefUpdates);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
index e865da83b1..23e8de0e35 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DefaultTypedConfigGetter.java
@@ -134,11 +134,9 @@ public class DefaultTypedConfigGetter implements TypedConfigGetter {
throw new IllegalArgumentException(
MessageFormat.format(JGitText.get().enumValueNotSupported3,
section, subsection, name, value));
- } else {
- throw new IllegalArgumentException(
- MessageFormat.format(JGitText.get().enumValueNotSupported2,
- section, name, value));
}
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().enumValueNotSupported2, section, name, value));
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
index ce1eb597fc..b87a031f58 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
@@ -536,63 +536,67 @@ public class IndexDiff {
if (ignoreSubmoduleMode != IgnoreSubmoduleMode.ALL) {
IgnoreSubmoduleMode localIgnoreSubmoduleMode = ignoreSubmoduleMode;
- SubmoduleWalk smw = SubmoduleWalk.forIndex(repository);
- while (smw.next()) {
- try {
- if (localIgnoreSubmoduleMode == null)
- localIgnoreSubmoduleMode = smw.getModulesIgnore();
- if (IgnoreSubmoduleMode.ALL
- .equals(localIgnoreSubmoduleMode))
- continue;
- } catch (ConfigInvalidException e) {
- throw new IOException(MessageFormat.format(
- JGitText.get().invalidIgnoreParamSubmodule,
- smw.getPath()), e);
- }
- try (Repository subRepo = smw.getRepository()) {
- String subRepoPath = smw.getPath();
- if (subRepo != null) {
- ObjectId subHead = subRepo.resolve("HEAD"); //$NON-NLS-1$
- if (subHead != null
- && !subHead.equals(smw.getObjectId())) {
- modified.add(subRepoPath);
- recordFileMode(subRepoPath, FileMode.GITLINK);
- } else if (ignoreSubmoduleMode != IgnoreSubmoduleMode.DIRTY) {
- IndexDiff smid = submoduleIndexDiffs.get(smw
- .getPath());
- if (smid == null) {
- smid = new IndexDiff(subRepo,
- smw.getObjectId(),
- wTreeIt.getWorkingTreeIterator(subRepo));
- submoduleIndexDiffs.put(subRepoPath, smid);
- }
- if (smid.diff()) {
- if (ignoreSubmoduleMode == IgnoreSubmoduleMode.UNTRACKED
- && smid.getAdded().isEmpty()
- && smid.getChanged().isEmpty()
- && smid.getConflicting().isEmpty()
- && smid.getMissing().isEmpty()
- && smid.getModified().isEmpty()
- && smid.getRemoved().isEmpty()) {
- continue;
- }
+ try (SubmoduleWalk smw = new SubmoduleWalk(repository)) {
+ smw.setTree(new DirCacheIterator(dirCache));
+ while (smw.next()) {
+ try {
+ if (localIgnoreSubmoduleMode == null)
+ localIgnoreSubmoduleMode = smw.getModulesIgnore();
+ if (IgnoreSubmoduleMode.ALL
+ .equals(localIgnoreSubmoduleMode))
+ continue;
+ } catch (ConfigInvalidException e) {
+ throw new IOException(MessageFormat.format(
+ JGitText.get().invalidIgnoreParamSubmodule,
+ smw.getPath()), e);
+ }
+ try (Repository subRepo = smw.getRepository()) {
+ String subRepoPath = smw.getPath();
+ if (subRepo != null) {
+ ObjectId subHead = subRepo.resolve("HEAD"); //$NON-NLS-1$
+ if (subHead != null
+ && !subHead.equals(smw.getObjectId())) {
modified.add(subRepoPath);
recordFileMode(subRepoPath, FileMode.GITLINK);
+ } else if (ignoreSubmoduleMode != IgnoreSubmoduleMode.DIRTY) {
+ IndexDiff smid = submoduleIndexDiffs
+ .get(smw.getPath());
+ if (smid == null) {
+ smid = new IndexDiff(subRepo,
+ smw.getObjectId(),
+ wTreeIt.getWorkingTreeIterator(
+ subRepo));
+ submoduleIndexDiffs.put(subRepoPath, smid);
+ }
+ if (smid.diff()) {
+ if (ignoreSubmoduleMode == IgnoreSubmoduleMode.UNTRACKED
+ && smid.getAdded().isEmpty()
+ && smid.getChanged().isEmpty()
+ && smid.getConflicting().isEmpty()
+ && smid.getMissing().isEmpty()
+ && smid.getModified().isEmpty()
+ && smid.getRemoved().isEmpty()) {
+ continue;
+ }
+ modified.add(subRepoPath);
+ recordFileMode(subRepoPath,
+ FileMode.GITLINK);
+ }
}
- }
- } else if (missingSubmodules.remove(subRepoPath)) {
- // If the directory is there and empty but the submodule
- // repository in .git/modules doesn't exist yet it isn't
- // "missing".
- File gitDir = new File(
- new File(repository.getDirectory(),
- Constants.MODULES),
- subRepoPath);
- if (!gitDir.isDirectory()) {
- File dir = SubmoduleWalk.getSubmoduleDirectory(
- repository, subRepoPath);
- if (dir.isDirectory() && !hasFiles(dir)) {
- missing.remove(subRepoPath);
+ } else if (missingSubmodules.remove(subRepoPath)) {
+ // If the directory is there and empty but the
+ // submodule repository in .git/modules doesn't
+ // exist yet it isn't "missing".
+ File gitDir = new File(
+ new File(repository.getDirectory(),
+ Constants.MODULES),
+ subRepoPath);
+ if (!gitDir.isDirectory()) {
+ File dir = SubmoduleWalk.getSubmoduleDirectory(
+ repository, subRepoPath);
+ if (dir.isDirectory() && !hasFiles(dir)) {
+ missing.remove(subRepoPath);
+ }
}
}
}
@@ -602,16 +606,17 @@ public class IndexDiff {
}
// consume the remaining work
- if (monitor != null)
+ if (monitor != null) {
monitor.endTask();
+ }
ignored = indexDiffFilter.getIgnoredPaths();
if (added.isEmpty() && changed.isEmpty() && removed.isEmpty()
&& missing.isEmpty() && modified.isEmpty()
- && untracked.isEmpty())
+ && untracked.isEmpty()) {
return false;
- else
- return true;
+ }
+ return true;
}
private boolean hasFiles(File directory) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
index 700b9dbe85..e14fb102b7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java
@@ -293,9 +293,8 @@ public abstract class ObjectReader implements AutoCloseable {
if (idItr.hasNext()) {
cur = idItr.next();
return true;
- } else {
- return false;
}
+ return false;
}
@Override
@@ -383,9 +382,8 @@ public abstract class ObjectReader implements AutoCloseable {
cur = idItr.next();
sz = getObjectSize(cur, OBJ_ANY);
return true;
- } else {
- return false;
}
+ return false;
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index 68866ea279..0e9cf58cf2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -503,9 +503,8 @@ public abstract class Repository implements AutoCloseable {
if (resolved instanceof String) {
final Ref ref = findRef((String) resolved);
return ref != null ? ref.getLeaf().getObjectId() : null;
- } else {
- return (ObjectId) resolved;
}
+ return (ObjectId) resolved;
}
}
@@ -527,11 +526,12 @@ public abstract class Repository implements AutoCloseable {
try (RevWalk rw = new RevWalk(this)) {
rw.setRetainBody(true);
Object resolved = resolve(rw, revstr);
- if (resolved != null)
- if (resolved instanceof String)
+ if (resolved != null) {
+ if (resolved instanceof String) {
return (String) resolved;
- else
- return ((AnyObjectId) resolved).getName();
+ }
+ return ((AnyObjectId) resolved).getName();
+ }
return null;
}
}
@@ -760,15 +760,15 @@ public abstract class Repository implements AutoCloseable {
if (name == null)
throw new RevisionSyntaxException(revstr);
} else if (time.matches("^-\\d+$")) { //$NON-NLS-1$
- if (name != null)
+ if (name != null) {
throw new RevisionSyntaxException(revstr);
- else {
- String previousCheckout = resolveReflogCheckout(-Integer
- .parseInt(time));
- if (ObjectId.isId(previousCheckout))
- rev = parseSimple(rw, previousCheckout);
- else
- name = previousCheckout;
+ }
+ String previousCheckout = resolveReflogCheckout(
+ -Integer.parseInt(time));
+ if (ObjectId.isId(previousCheckout)) {
+ rev = parseSimple(rw, previousCheckout);
+ } else {
+ name = previousCheckout;
}
} else {
if (name == null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
index 11db7c5998..f28334cb80 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgKeyLocator.java
@@ -72,12 +72,14 @@ import org.bouncycastle.gpg.keybox.PublicKeyRingBlob;
import org.bouncycastle.gpg.keybox.UserID;
import org.bouncycastle.gpg.keybox.jcajce.JcaKeyBoxBuilder;
import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPKeyFlags;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
+import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.PBEProtectionRemoverFactory;
import org.bouncycastle.openpgp.operator.PGPDigestCalculatorProvider;
@@ -90,6 +92,7 @@ import org.eclipse.jgit.api.errors.CanceledException;
import org.eclipse.jgit.errors.UnsupportedCredentialItem;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.util.FS;
+import org.eclipse.jgit.util.StringUtils;
import org.eclipse.jgit.util.SystemReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -190,19 +193,92 @@ class BouncyCastleGpgKeyLocator {
}
}
- private boolean containsSigningKey(String userId) {
- return userId.toLowerCase(Locale.ROOT)
- .contains(signingKey.toLowerCase(Locale.ROOT));
+ /**
+ * Checks whether a given OpenPGP {@code userId} matches a given
+ * {@code signingKeySpec}, which is supposed to have one of the formats
+ * defined by GPG.
+ * <p>
+ * Not all formats are supported; only formats starting with '=', '&lt;',
+ * '@', and '*' are handled. Any other format results in a case-insensitive
+ * substring match.
+ * </p>
+ *
+ * @param userId
+ * of a key
+ * @param signingKeySpec
+ * GPG key identification
+ * @return whether the {@code userId} matches
+ * @see <a href=
+ * "https://www.gnupg.org/documentation/manuals/gnupg/Specify-a-User-ID.html">GPG
+ * Documentation: How to Specify a User ID</a>
+ */
+ static boolean containsSigningKey(String userId, String signingKeySpec) {
+ if (StringUtils.isEmptyOrNull(userId)
+ || StringUtils.isEmptyOrNull(signingKeySpec)) {
+ return false;
+ }
+ String toMatch = signingKeySpec;
+ if (toMatch.startsWith("0x") && toMatch.trim().length() > 2) { //$NON-NLS-1$
+ return false; // Explicit fingerprint
+ }
+ int command = toMatch.charAt(0);
+ switch (command) {
+ case '=':
+ case '<':
+ case '@':
+ case '*':
+ toMatch = toMatch.substring(1);
+ if (toMatch.isEmpty()) {
+ return false;
+ }
+ break;
+ default:
+ break;
+ }
+ switch (command) {
+ case '=':
+ return userId.equals(toMatch);
+ case '<': {
+ int begin = userId.indexOf('<');
+ int end = userId.indexOf('>', begin + 1);
+ int stop = toMatch.indexOf('>');
+ return begin >= 0 && end > begin + 1 && stop > 0
+ && userId.substring(begin + 1, end)
+ .equals(toMatch.substring(0, stop));
+ }
+ case '@': {
+ int begin = userId.indexOf('<');
+ int end = userId.indexOf('>', begin + 1);
+ return begin >= 0 && end > begin + 1
+ && userId.substring(begin + 1, end).contains(toMatch);
+ }
+ default:
+ if (toMatch.trim().isEmpty()) {
+ return false;
+ }
+ return userId.toLowerCase(Locale.ROOT)
+ .contains(toMatch.toLowerCase(Locale.ROOT));
+ }
+ }
+
+ private String toFingerprint(String keyId) {
+ if (keyId.startsWith("0x")) { //$NON-NLS-1$
+ return keyId.substring(2);
+ }
+ return keyId;
}
private PGPPublicKey findPublicKeyByKeyId(KeyBlob keyBlob)
throws IOException {
- String keyId = signingKey.toLowerCase(Locale.ROOT);
+ String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
+ if (keyId.isEmpty()) {
+ return null;
+ }
for (KeyInformation keyInfo : keyBlob.getKeyInformation()) {
String fingerprint = Hex.toHexString(keyInfo.getFingerprint())
.toLowerCase(Locale.ROOT);
if (fingerprint.endsWith(keyId)) {
- return getFirstPublicKey(keyBlob);
+ return getPublicKey(keyBlob, keyInfo.getFingerprint());
}
}
return null;
@@ -211,8 +287,8 @@ class BouncyCastleGpgKeyLocator {
private PGPPublicKey findPublicKeyByUserId(KeyBlob keyBlob)
throws IOException {
for (UserID userID : keyBlob.getUserIds()) {
- if (containsSigningKey(userID.getUserIDAsString())) {
- return getFirstPublicKey(keyBlob);
+ if (containsSigningKey(userID.getUserIDAsString(), signingKey)) {
+ return getSigningPublicKey(keyBlob);
}
}
return null;
@@ -444,7 +520,7 @@ class BouncyCastleGpgKeyLocator {
PGPUtil.getDecoderStream(new BufferedInputStream(in)),
new JcaKeyFingerprintCalculator());
- String keyId = signingkey.toLowerCase(Locale.ROOT);
+ String keyId = toFingerprint(signingkey).toLowerCase(Locale.ROOT);
Iterator<PGPSecretKeyRing> keyrings = pgpSec.getKeyRings();
while (keyrings.hasNext()) {
PGPSecretKeyRing keyRing = keyrings.next();
@@ -462,7 +538,7 @@ class BouncyCastleGpgKeyLocator {
Iterator<String> userIDs = key.getUserIDs();
while (userIDs.hasNext()) {
String userId = userIDs.next();
- if (containsSigningKey(userId)) {
+ if (containsSigningKey(userId, signingKey)) {
return key;
}
}
@@ -490,7 +566,7 @@ class BouncyCastleGpgKeyLocator {
new BufferedInputStream(in),
new JcaKeyFingerprintCalculator());
- String keyId = signingKey.toLowerCase(Locale.ROOT);
+ String keyId = toFingerprint(signingKey).toLowerCase(Locale.ROOT);
Iterator<PGPPublicKeyRing> keyrings = pgpPub.getKeyRings();
while (keyrings.hasNext()) {
PGPPublicKeyRing keyRing = keyrings.next();
@@ -507,7 +583,7 @@ class BouncyCastleGpgKeyLocator {
Iterator<String> userIDs = key.getUserIDs();
while (userIDs.hasNext()) {
String userId = userIDs.next();
- if (containsSigningKey(userId)) {
+ if (containsSigningKey(userId, signingKey)) {
return key;
}
}
@@ -517,9 +593,42 @@ class BouncyCastleGpgKeyLocator {
return null;
}
- private PGPPublicKey getFirstPublicKey(KeyBlob keyBlob) throws IOException {
- return ((PublicKeyRingBlob) keyBlob).getPGPPublicKeyRing()
- .getPublicKey();
+ private PGPPublicKey getPublicKey(KeyBlob blob, byte[] fingerprint)
+ throws IOException {
+ return ((PublicKeyRingBlob) blob).getPGPPublicKeyRing()
+ .getPublicKey(fingerprint);
+ }
+
+ private PGPPublicKey getSigningPublicKey(KeyBlob blob) throws IOException {
+ PGPPublicKey masterKey = null;
+ Iterator<PGPPublicKey> keys = ((PublicKeyRingBlob) blob)
+ .getPGPPublicKeyRing().getPublicKeys();
+ while (keys.hasNext()) {
+ PGPPublicKey key = keys.next();
+ // only consider keys that have the [S] usage flag set
+ if (isSigningKey(key)) {
+ if (key.isMasterKey()) {
+ masterKey = key;
+ } else {
+ return key;
+ }
+ }
+ }
+ // return the master key if no other signing key was found or null if
+ // the master key did not have the signing flag set
+ return masterKey;
+ }
+
+ private boolean isSigningKey(PGPPublicKey key) {
+ Iterator signatures = key.getSignatures();
+ while (signatures.hasNext()) {
+ PGPSignature sig = (PGPSignature) signatures.next();
+ if ((sig.getHashedSubPackets().getKeyFlags()
+ & PGPKeyFlags.CAN_SIGN) > 0) {
+ return true;
+ }
+ }
+ return false;
}
private KeyBox readKeyBoxFile(Path keyboxFile) throws IOException,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java
index cfe0931b47..cfa67eefdc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/internal/BouncyCastleGpgSigner.java
@@ -115,7 +115,7 @@ public class BouncyCastleGpgSigner extends GpgSigner {
NoSuchAlgorithmException, NoSuchProviderException, PGPException,
URISyntaxException {
if (gpgSigningKey == null || gpgSigningKey.isEmpty()) {
- gpgSigningKey = committer.getEmailAddress();
+ gpgSigningKey = '<' + committer.getEmailAddress() + '>';
}
BouncyCastleGpgKeyLocator keyHelper = new BouncyCastleGpgKeyLocator(
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java
index cdbe3cd26c..12f353e0da 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeConfig.java
@@ -166,10 +166,10 @@ public class MergeConfig {
String mergeOptions = config.getString(
ConfigConstants.CONFIG_BRANCH_SECTION, branch,
ConfigConstants.CONFIG_KEY_MERGEOPTIONS);
- if (mergeOptions != null)
+ if (mergeOptions != null) {
return mergeOptions.split("\\s"); //$NON-NLS-1$
- else
- return new String[0];
+ }
+ return new String[0];
}
private static class MergeConfigSectionParser implements
@@ -188,10 +188,10 @@ public class MergeConfig {
@Override
public boolean equals(Object obj) {
- if (obj instanceof MergeConfigSectionParser)
+ if (obj instanceof MergeConfigSectionParser) {
return branch.equals(((MergeConfigSectionParser) obj).branch);
- else
- return false;
+ }
+ return false;
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
index ca0e18a0ef..ca2f37abee 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java
@@ -153,15 +153,16 @@ public class MergeMessageFormatter {
private static void addConflictsMessage(List<String> conflictingPaths,
StringBuilder sb) {
sb.append("Conflicts:\n"); //$NON-NLS-1$
- for (String conflictingPath : conflictingPaths)
+ for (String conflictingPath : conflictingPaths) {
sb.append('\t').append(conflictingPath).append('\n');
+ }
}
private static String joinNames(List<String> names, String singular,
String plural) {
- if (names.size() == 1)
+ if (names.size() == 1) {
return singular + " " + names.get(0); //$NON-NLS-1$
- else
- return plural + " " + StringUtils.join(names, ", ", " and "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return plural + " " + StringUtils.join(names, ", ", " and "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
index 0b423fb5d4..e0b00c0bd7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -652,42 +652,40 @@ public class ResolveMerger extends ThreeWayMerger {
keep(ourDce);
// no checkout needed!
return true;
- } else {
- // same content but different mode on OURS and THEIRS.
- // Try to merge the mode and report an error if this is
- // not possible.
- int newMode = mergeFileModes(modeB, modeO, modeT);
- if (newMode != FileMode.MISSING.getBits()) {
- if (newMode == modeO)
- // ours version is preferred
- keep(ourDce);
- else {
- // the preferred version THEIRS has a different mode
- // than ours. Check it out!
- if (isWorktreeDirty(work, ourDce))
- return false;
- // we know about length and lastMod only after we have written the new content.
- // This will happen later. Set these values to 0 for know.
- DirCacheEntry e = add(tw.getRawPath(), theirs,
- DirCacheEntry.STAGE_0, EPOCH, 0);
- addToCheckout(tw.getPathString(), e, attributes);
- }
- return true;
+ }
+ // same content but different mode on OURS and THEIRS.
+ // Try to merge the mode and report an error if this is
+ // not possible.
+ int newMode = mergeFileModes(modeB, modeO, modeT);
+ if (newMode != FileMode.MISSING.getBits()) {
+ if (newMode == modeO) {
+ // ours version is preferred
+ keep(ourDce);
} else {
- // FileModes are not mergeable. We found a conflict on modes.
- // For conflicting entries we don't know lastModified and length.
- add(tw.getRawPath(), base, DirCacheEntry.STAGE_1, EPOCH, 0);
- add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2, EPOCH, 0);
- add(tw.getRawPath(), theirs, DirCacheEntry.STAGE_3, EPOCH,
- 0);
- unmergedPaths.add(tw.getPathString());
- mergeResults.put(
- tw.getPathString(),
- new MergeResult<>(Collections
- .<RawText> emptyList()));
+ // the preferred version THEIRS has a different mode
+ // than ours. Check it out!
+ if (isWorktreeDirty(work, ourDce)) {
+ return false;
+ }
+ // we know about length and lastMod only after we have
+ // written the new content.
+ // This will happen later. Set these values to 0 for know.
+ DirCacheEntry e = add(tw.getRawPath(), theirs,
+ DirCacheEntry.STAGE_0, EPOCH, 0);
+ addToCheckout(tw.getPathString(), e, attributes);
}
return true;
}
+ // FileModes are not mergeable. We found a conflict on modes.
+ // For conflicting entries we don't know lastModified and
+ // length.
+ add(tw.getRawPath(), base, DirCacheEntry.STAGE_1, EPOCH, 0);
+ add(tw.getRawPath(), ours, DirCacheEntry.STAGE_2, EPOCH, 0);
+ add(tw.getRawPath(), theirs, DirCacheEntry.STAGE_3, EPOCH, 0);
+ unmergedPaths.add(tw.getPathString());
+ mergeResults.put(tw.getPathString(),
+ new MergeResult<>(Collections.<RawText> emptyList()));
+ return true;
}
if (modeB == modeT && tw.idEqual(T_BASE, T_THEIRS)) {
@@ -716,21 +714,20 @@ public class ResolveMerger extends ThreeWayMerger {
addToCheckout(tw.getPathString(), e, attributes);
}
return true;
- } else {
- // we want THEIRS ... but THEIRS contains a folder or the
- // deletion of the path. Delete what's in the working tree,
- // which we know to be clean.
- if (tw.getTreeCount() > T_FILE && tw.getRawMode(T_FILE) == 0) {
- // Not present in working tree, so nothing to delete
- return true;
- }
- if (modeT != 0 && modeT == modeB) {
- // Base, ours, and theirs all contain a folder: don't delete
- return true;
- }
- addDeletion(tw.getPathString(), nonTree(modeO), attributes);
+ }
+ // we want THEIRS ... but THEIRS contains a folder or the
+ // deletion of the path. Delete what's in the working tree,
+ // which we know to be clean.
+ if (tw.getTreeCount() > T_FILE && tw.getRawMode(T_FILE) == 0) {
+ // Not present in working tree, so nothing to delete
return true;
}
+ if (modeT != 0 && modeT == modeB) {
+ // Base, ours, and theirs all contain a folder: don't delete
+ return true;
+ }
+ addDeletion(tw.getPathString(), nonTree(modeO), attributes);
+ return true;
}
if (tw.isSubtree()) {
@@ -1310,10 +1307,9 @@ public class ResolveMerger extends ThreeWayMerger {
if (getUnmergedPaths().isEmpty() && !failed()) {
resultTree = dircache.writeTree(getObjectInserter());
return true;
- } else {
- resultTree = null;
- return false;
}
+ resultTree = null;
+ return false;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java
index 2fc0f4f073..d56e5c0c1e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ThreeWayMerger.java
@@ -143,17 +143,17 @@ public abstract class ThreeWayMerger extends Merger {
* @throws java.io.IOException
*/
protected AbstractTreeIterator mergeBase() throws IOException {
- if (baseTree != null)
+ if (baseTree != null) {
return openTree(baseTree);
+ }
RevCommit baseCommit = (baseCommitId != null) ? walk
.parseCommit(baseCommitId) : getBaseCommit(sourceCommits[0],
sourceCommits[1]);
if (baseCommit == null) {
baseCommitId = null;
return new EmptyTreeIterator();
- } else {
- baseCommitId = baseCommit.toObjectId();
- return openTree(baseCommit.getTree());
}
+ baseCommitId = baseCommit.toObjectId();
+ return openTree(baseCommit.getTree());
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java
index 7827a9aa05..c1616b3ed8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/FanoutBucket.java
@@ -167,10 +167,10 @@ class FanoutBucket extends InMemoryNoteBucket {
@Override
public Note next() {
- if (hasNext())
+ if (hasNext()) {
return itr.next();
- else
- throw new NoSuchElementException();
+ }
+ throw new NoSuchElementException();
}
@Override
@@ -214,30 +214,31 @@ class FanoutBucket extends InMemoryNoteBucket {
NoteBucket b = table[cell];
if (b == null) {
- if (noteData == null)
+ if (noteData == null) {
return this;
+ }
LeafBucket n = new LeafBucket(prefixLen + 2);
table[cell] = n.set(noteOn, noteData, or);
cnt++;
return this;
- } else {
- NoteBucket n = b.set(noteOn, noteData, or);
- if (n == null) {
- table[cell] = null;
- cnt--;
+ }
+ NoteBucket n = b.set(noteOn, noteData, or);
+ if (n == null) {
+ table[cell] = null;
+ cnt--;
- if (cnt == 0)
- return null;
+ if (cnt == 0) {
+ return null;
+ }
- return contractIfTooSmall(noteOn, or);
+ return contractIfTooSmall(noteOn, or);
- } else if (n != b) {
- table[cell] = n;
- }
- return this;
+ } else if (n != b) {
+ table[cell] = n;
}
+ return this;
}
InMemoryNoteBucket contractIfTooSmall(AnyObjectId noteOn, ObjectReader or)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java
index 6723b6309c..0fa2a6306c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/LeafBucket.java
@@ -129,10 +129,10 @@ class LeafBucket extends InMemoryNoteBucket {
@Override
public Note next() {
- if (hasNext())
+ if (hasNext()) {
return notes[idx++];
- else
- throw new NoSuchElementException();
+ }
+ throw new NoSuchElementException();
}
@Override
@@ -156,25 +156,23 @@ class LeafBucket extends InMemoryNoteBucket {
notes[p].setData(noteData.copy());
return this;
- } else {
- System.arraycopy(notes, p + 1, notes, p, cnt - p - 1);
- cnt--;
- return 0 < cnt ? this : null;
}
+ System.arraycopy(notes, p + 1, notes, p, cnt - p - 1);
+ cnt--;
+ return 0 < cnt ? this : null;
} else if (noteData != null) {
if (shouldSplit()) {
return split().set(noteOn, noteData, or);
-
- } else {
- growIfFull();
- p = -(p + 1);
- if (p < cnt)
- System.arraycopy(notes, p, notes, p + 1, cnt - p);
- notes[p] = new Note(noteOn, noteData.copy());
- cnt++;
- return this;
}
+ growIfFull();
+ p = -(p + 1);
+ if (p < cnt) {
+ System.arraycopy(notes, p, notes, p + 1, cnt - p);
+ }
+ notes[p] = new Note(noteOn, noteData.copy());
+ cnt++;
+ return this;
} else {
return this;
@@ -234,12 +232,10 @@ class LeafBucket extends InMemoryNoteBucket {
InMemoryNoteBucket append(Note note) {
if (shouldSplit()) {
return split().append(note);
-
- } else {
- growIfFull();
- notes[cnt++] = note;
- return this;
}
+ growIfFull();
+ notes[cnt++] = note;
+ return this;
}
private void growIfFull() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java
index cbef61338f..e4eef433d8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMap.java
@@ -278,10 +278,10 @@ public class NoteMap implements Iterable<Note> {
public byte[] getCachedBytes(AnyObjectId id, int sizeLimit)
throws LargeObjectException, MissingObjectException, IOException {
ObjectId dataId = get(id);
- if (dataId != null)
+ if (dataId != null) {
return reader.open(dataId).getCachedBytes(sizeLimit);
- else
- return null;
+ }
+ return null;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java
index ba7223b8f0..6ff1402900 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteMapMerger.java
@@ -307,10 +307,10 @@ public class NoteMapMerger {
private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result,
Note note) {
- if (note != null)
+ if (note != null) {
return result.append(note);
- else
- return result;
+ }
+ return result;
}
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
index 8ef3af10ad..7dfc47deb0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/NoteParser.java
@@ -181,9 +181,8 @@ final class NoteParser extends CanonicalTreeParser {
} catch (ArrayIndexOutOfBoundsException notHex) {
return -1;
}
- } else {
- return -1;
}
+ return -1;
}
private void storeNonNote() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
index 45508ce027..2bb45c55dc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
@@ -391,11 +391,10 @@ public class PlotCommitList<L extends PlotLane> extends
return pos.intValue();
}
return positionsAllocated++;
- } else {
- final Integer min = freePositions.first();
- freePositions.remove(min);
- return min.intValue();
}
+ final Integer min = freePositions.first();
+ freePositions.remove(min);
+ return min.intValue();
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
index ee18fe7c2f..19e40b562b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
@@ -176,11 +176,10 @@ public class PlotWalk extends RevWalk {
Collection<Ref> list = reverseRefMap.get(commitId);
if (list == null) {
return PlotCommit.NO_REFS;
- } else {
- Ref[] tags = list.toArray(new Ref[0]);
- Arrays.sort(tags, new PlotRefComparator());
- return tags;
}
+ Ref[] tags = list.toArray(new Ref[0]);
+ Arrays.sort(tags, new PlotRefComparator());
+ return tags;
}
class PlotRefComparator implements Comparator<Ref> {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
index f7c3218850..090d1e110c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
@@ -169,19 +169,19 @@ public class TreeRevFilter extends RevFilter {
//
c.flags |= rewriteFlag;
return false;
- } else {
- // We have interesting items, but neither of the special
- // cases denoted above.
+ }
+
+ // We have interesting items, but neither of the special
+ // cases denoted above.
+ //
+ if (adds > 0 && tw.getFilter() instanceof FollowFilter) {
+ // One of the paths we care about was added in this
+ // commit. We need to update our filter to its older
+ // name, if we can discover it. Find out what that is.
//
- if (adds > 0 && tw.getFilter() instanceof FollowFilter) {
- // One of the paths we care about was added in this
- // commit. We need to update our filter to its older
- // name, if we can discover it. Find out what that is.
- //
- updateFollowFilter(trees, ((FollowFilter) tw.getFilter()).cfg);
- }
- return true;
+ updateFollowFilter(trees, ((FollowFilter) tw.getFilter()).cfg);
}
+ return true;
} else if (nParents == 0) {
// We have no parents to compare against. Consider us to be
// REWRITE only if we have no paths matching our filter.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java
index e6e3d4fb12..645da0a068 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackStatistics.java
@@ -271,6 +271,20 @@ public class PackStatistics {
public long treesTraversed;
/**
+ * Amount of packfile uris sent to the client to download via HTTP.
+ *
+ * @since 5.6
+ */
+ public long offloadedPackfiles;
+
+ /**
+ * Total size (in bytes) offloaded to HTTP downloads.
+ *
+ * @since 5.6
+ */
+ public long offloadedPackfileSize;
+
+ /**
* Statistics about each object type in the pack (commits, tags, trees
* and blobs.)
*/
@@ -598,6 +612,22 @@ public class PackStatistics {
}
/**
+ * @return amount of packfiles offloaded (sent as "packfile-uri")/
+ * @since 5.6
+ */
+ public long getOffloadedPackfiles() {
+ return statistics.offloadedPackfiles;
+ }
+
+ /**
+ * @return total size (in bytes) offloaded to HTTP downloads.
+ * @since 5.6
+ */
+ public long getOffloadedPackfilesSize() {
+ return statistics.offloadedPackfileSize;
+ }
+
+ /**
* Get total time spent processing this pack.
*
* @return total time spent processing this pack.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
index e402de0158..d4fa17e25e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java
@@ -1579,14 +1579,15 @@ public abstract class BaseReceivePack {
RevObject o;
while ((o = ow.nextObject()) != null) {
checking.update(1);
- if (o.has(RevFlag.UNINTERESTING))
+ if (o.has(RevFlag.UNINTERESTING)) {
continue;
+ }
if (providedObjects != null) {
- if (providedObjects.contains(o))
+ if (providedObjects.contains(o)) {
continue;
- else
- throw new MissingObjectException(o, o.getType());
+ }
+ throw new MissingObjectException(o, o.getType());
}
if (o instanceof RevBlob && !db.getObjectDatabase().has(o))
@@ -1597,8 +1598,9 @@ public abstract class BaseReceivePack {
if (baseObjects != null) {
for (ObjectId id : baseObjects) {
o = ow.parseAny(id);
- if (!o.has(RevFlag.UNINTERESTING))
+ if (!o.has(RevFlag.UNINTERESTING)) {
throw new MissingObjectException(o, o.getType());
+ }
}
}
}
@@ -1613,6 +1615,24 @@ public abstract class BaseReceivePack {
if (cmd.getResult() != Result.NOT_ATTEMPTED)
continue;
+ RevObject newObj = null;
+ if (cmd.getType() == ReceiveCommand.Type.CREATE
+ || cmd.getType() == ReceiveCommand.Type.UPDATE) {
+ try {
+ newObj = walk.parseAny(cmd.getNewId());
+ } catch (IOException e) {
+ cmd.setResult(Result.REJECTED_MISSING_OBJECT,
+ cmd.getNewId().name());
+ continue;
+ }
+ if (cmd.getRefName().startsWith(Constants.R_HEADS)
+ && !(newObj instanceof RevCommit)) {
+ cmd.setResult(Result.REJECTED_OTHER_REASON,
+ JGitText.get().nonCommitToHeads);
+ continue;
+ }
+ }
+
if (cmd.getType() == ReceiveCommand.Type.DELETE) {
if (!isAllowDeletes()) {
// Deletes are not supported on this repository.
@@ -1694,7 +1714,7 @@ public abstract class BaseReceivePack {
// Is this possibly a non-fast-forward style update?
//
- RevObject oldObj, newObj;
+ RevObject oldObj;
try {
oldObj = walk.parseAny(cmd.getOldId());
} catch (IOException e) {
@@ -1703,14 +1723,6 @@ public abstract class BaseReceivePack {
continue;
}
- try {
- newObj = walk.parseAny(cmd.getNewId());
- } catch (IOException e) {
- cmd.setResult(Result.REJECTED_MISSING_OBJECT, cmd
- .getNewId().name());
- continue;
- }
-
if (oldObj instanceof RevCommit && newObj instanceof RevCommit) {
try {
if (walk.isMergedInto((RevCommit) oldObj,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java
index d901021788..6325a23530 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java
@@ -107,10 +107,9 @@ public class CredentialsProviderUserInfo implements UserInfo,
if (provider.get(uri, v)) {
passphrase = v.getValue();
return true;
- } else {
- passphrase = null;
- return false;
}
+ passphrase = null;
+ return false;
}
/** {@inheritDoc} */
@@ -120,10 +119,9 @@ public class CredentialsProviderUserInfo implements UserInfo,
if (provider.get(uri, p)) {
password = new String(p.getValue());
return true;
- } else {
- password = null;
- return false;
}
+ password = null;
+ return false;
}
private CredentialItem.StringType newPrompt(String msg) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
index 01f6fec7e4..72e95e6ba3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HMACSHA1NonceGenerator.java
@@ -135,9 +135,8 @@ public class HMACSHA1NonceGenerator implements NonceGenerator {
if (nonceStampSlop <= slop) {
return NonceStatus.OK;
- } else {
- return NonceStatus.SLOP;
}
+ return NonceStatus.SLOP;
}
private static final String HEX = "0123456789ABCDEF"; //$NON-NLS-1$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
index 14ccddfb61..c2f69e20be 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ProtocolV2Parser.java
@@ -215,7 +215,7 @@ final class ProtocolV2Parser {
&& line2.equals(OPTION_SIDEBAND_ALL)) {
reqBuilder.setSidebandAll(true);
} else if (line2.startsWith("packfile-uris ")) { //$NON-NLS-1$
- for (String s : line2.substring(14).split(",")) {
+ for (String s : line2.substring(14).split(",")) { //$NON-NLS-1$
reqBuilder.addPackfileUriProtocol(s);
}
} else {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java
index 0a621f19e1..4474d1a858 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java
@@ -292,22 +292,26 @@ public class RemoteConfig implements Serializable {
private String replaceUri(final String uri,
final Map<String, String> replacements) {
- if (replacements.isEmpty())
+ if (replacements.isEmpty()) {
return uri;
+ }
Entry<String, String> match = null;
for (Entry<String, String> replacement : replacements.entrySet()) {
// Ignore current entry if not longer than previous match
if (match != null
- && match.getKey().length() > replacement.getKey().length())
+ && match.getKey().length() > replacement.getKey()
+ .length()) {
continue;
- if (!uri.startsWith(replacement.getKey()))
+ }
+ if (!uri.startsWith(replacement.getKey())) {
continue;
+ }
match = replacement;
}
- if (match != null)
+ if (match != null) {
return match.getValue() + uri.substring(match.getKey().length());
- else
- return uri;
+ }
+ return uri;
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
index 758d74c3fa..100b433e00 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java
@@ -132,6 +132,7 @@ public class TransferConfig {
private final boolean allowReachableSha1InWant;
private final boolean allowFilter;
private final boolean allowSidebandAll;
+ private final boolean advertiseSidebandAll;
final @Nullable ProtocolVersion protocolVersion;
final String[] hideRefs;
@@ -213,6 +214,8 @@ public class TransferConfig {
hideRefs = rc.getStringList("uploadpack", null, "hiderefs");
allowSidebandAll = rc.getBoolean(
"uploadpack", "allowsidebandall", false);
+ advertiseSidebandAll = rc.getBoolean("uploadpack",
+ "advertisesidebandall", false);
}
/**
@@ -295,7 +298,8 @@ public class TransferConfig {
}
/**
- * @return true if clients are allowed to specify a "sideband-all" line
+ * @return true if the server accepts sideband-all requests (see
+ * {{@link #isAdvertiseSidebandAll()} for the advertisement)
* @since 5.5
*/
public boolean isAllowSidebandAll() {
@@ -303,6 +307,14 @@ public class TransferConfig {
}
/**
+ * @return true to advertise sideband all to the clients
+ * @since 5.6
+ */
+ public boolean isAdvertiseSidebandAll() {
+ return advertiseSidebandAll && allowSidebandAll;
+ }
+
+ /**
* Get {@link org.eclipse.jgit.transport.RefFilter} respecting configured
* hidden refs.
*
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
index 0b7907035e..2382f4c3af 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -302,11 +302,12 @@ public abstract class Transport implements AutoCloseable {
URISyntaxException, TransportException {
if (local != null) {
final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote);
- if (doesNotExist(cfg))
+ if (doesNotExist(cfg)) {
return open(local, new URIish(remote), null);
+ }
return open(local, cfg, op);
- } else
- return open(new URIish(remote));
+ }
+ return open(new URIish(remote));
}
@@ -708,11 +709,11 @@ public abstract class Transport implements AutoCloseable {
// try to find matching tracking refs
for (RefSpec fetchSpec : fetchSpecs) {
if (fetchSpec.matchSource(remoteName)) {
- if (fetchSpec.isWildcard())
+ if (fetchSpec.isWildcard()) {
return fetchSpec.expandFromSource(remoteName)
.getDestination();
- else
- return fetchSpec.getDestination();
+ }
+ return fetchSpec.getDestination();
}
}
return null;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index 3029327c52..2637a0273a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -698,9 +698,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
public CredentialItem[] items() {
if (forRepo == null) {
return new CredentialItem[] { message, now, always };
- } else {
- return new CredentialItem[] { message, now, forRepo, always };
}
+ return new CredentialItem[] { message, now, forRepo, always };
}
}
@@ -1076,13 +1075,11 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
host = host.toLowerCase(Locale.ROOT);
if (host.equals(cookieDomain)) {
return true;
- } else {
- if (!host.endsWith(cookieDomain)) {
- return false;
- }
- return host
- .charAt(host.length() - cookieDomain.length() - 1) == '.';
}
+ if (!host.endsWith(cookieDomain)) {
+ return false;
+ }
+ return host.charAt(host.length() - cookieDomain.length() - 1) == '.';
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index 7ca9cc134c..d5e03ebd57 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -351,10 +351,7 @@ public class URIish implements Serializable {
}
private String n2e(String s) {
- if (s == null)
- return ""; //$NON-NLS-1$
- else
- return s;
+ return s == null ? "" : s; //$NON-NLS-1$
}
// takes care to cut of a leading slash if a windows drive letter or a
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 20b45882df..5bee1ce9a7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.transport;
import static java.util.Collections.unmodifiableMap;
+import static java.util.Objects.requireNonNull;
import static org.eclipse.jgit.lib.Constants.R_TAGS;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_REF_IN_WANT;
import static org.eclipse.jgit.transport.GitProtocolConstants.CAPABILITY_SERVER_OPTION;
@@ -282,6 +283,8 @@ public class UploadPack {
private OutputStream msgOut = NullOutputStream.INSTANCE;
+ private ErrorWriter errOut = new PackProtocolErrorWriter();
+
/**
* Refs eligible for advertising to the client, set using
* {@link #setAdvertisedRefs}.
@@ -756,9 +759,59 @@ public class UploadPack {
/**
* Execute the upload task on the socket.
*
- * <p>If the client passed extra parameters (e.g., "version=2") through a
- * side channel, the caller must call setExtraParameters first to supply
- * them.
+ * <p>
+ * Same as {@link #uploadWithExceptionPropagation} except that the thrown
+ * exceptions are handled in the method, and the error messages are sent to
+ * the clients.
+ *
+ * <p>
+ * Call this method if the caller does not have an error handling mechanism.
+ * Call {@link #uploadWithExceptionPropagation} if the caller wants to have
+ * its own error handling mechanism.
+ *
+ * @param input
+ * @param output
+ * @param messages
+ * @throws java.io.IOException
+ */
+ public void upload(InputStream input, OutputStream output,
+ @Nullable OutputStream messages) throws IOException {
+ try {
+ uploadWithExceptionPropagation(input, output, messages);
+ } catch (ServiceMayNotContinueException err) {
+ if (!err.isOutput() && err.getMessage() != null) {
+ try {
+ errOut.writeError(err.getMessage());
+ } catch (IOException e) {
+ err.addSuppressed(e);
+ throw err;
+ }
+ err.setOutput();
+ }
+ throw err;
+ } catch (IOException | RuntimeException | Error err) {
+ if (rawOut != null) {
+ String msg = err instanceof PackProtocolException
+ ? err.getMessage()
+ : JGitText.get().internalServerError;
+ try {
+ errOut.writeError(msg);
+ } catch (IOException e) {
+ err.addSuppressed(e);
+ throw err;
+ }
+ throw new UploadPackInternalServerErrorException(err);
+ }
+ throw err;
+ }
+ }
+
+ /**
+ * Execute the upload task on the socket.
+ *
+ * <p>
+ * If the client passed extra parameters (e.g., "version=2") through a side
+ * channel, the caller must call setExtraParameters first to supply them.
*
* @param input
* raw input to read client commands from. Caller must ensure the
@@ -772,15 +825,21 @@ public class UploadPack {
* through. When run over SSH this should be tied back to the
* standard error channel of the command execution. For most
* other network connections this should be null.
- * @throws java.io.IOException
+ * @throws ServiceMayNotContinueException
+ * thrown if one of the hooks throws this.
+ * @throws IOException
+ * thrown if the server or the client I/O fails, or there's an
+ * internal server error.
+ * @since 5.6
*/
- public void upload(InputStream input, OutputStream output,
- @Nullable OutputStream messages) throws IOException {
- PacketLineOut pckOut = null;
+ public void uploadWithExceptionPropagation(InputStream input,
+ OutputStream output, @Nullable OutputStream messages)
+ throws ServiceMayNotContinueException, IOException {
try {
rawIn = input;
- if (messages != null)
+ if (messages != null) {
msgOut = messages;
+ }
if (timeout > 0) {
final Thread caller = Thread.currentThread();
@@ -800,42 +859,12 @@ public class UploadPack {
}
pckIn = new PacketLineIn(rawIn);
- pckOut = new PacketLineOut(rawOut);
+ PacketLineOut pckOut = new PacketLineOut(rawOut);
if (useProtocolV2()) {
serviceV2(pckOut);
} else {
service(pckOut);
}
- } catch (UploadPackInternalServerErrorException err) {
- // UploadPackInternalServerErrorException is a special exception
- // that indicates an error is already written to the client. Do
- // nothing.
- throw err;
- } catch (ServiceMayNotContinueException err) {
- if (!err.isOutput() && err.getMessage() != null && pckOut != null) {
- try {
- pckOut.writeString("ERR " + err.getMessage() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (IOException e) {
- err.addSuppressed(e);
- throw err;
- }
- err.setOutput();
- }
- throw err;
- } catch (IOException | RuntimeException | Error err) {
- if (pckOut != null) {
- String msg = err instanceof PackProtocolException
- ? err.getMessage()
- : JGitText.get().internalServerError;
- try {
- pckOut.writeString("ERR " + msg + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (IOException e) {
- err.addSuppressed(e);
- throw err;
- }
- throw new UploadPackInternalServerErrorException(err);
- }
- throw err;
} finally {
msgOut = NullOutputStream.INSTANCE;
walk.close();
@@ -1296,7 +1325,7 @@ public class UploadPack {
caps.add(COMMAND_FETCH + '='
+ (transferConfig.isAllowFilter() ? OPTION_FILTER + ' ' : "")
+ (advertiseRefInWant ? CAPABILITY_REF_IN_WANT + ' ' : "")
- + (transferConfig.isAllowSidebandAll()
+ + (transferConfig.isAdvertiseSidebandAll()
? OPTION_SIDEBAND_ALL + ' '
: "")
+ (cachedPackUriProvider != null ? "packfile-uris " : "")
@@ -2114,54 +2143,42 @@ public class UploadPack {
Set<String> caps = req.getClientCapabilities();
boolean sideband = caps.contains(OPTION_SIDE_BAND)
|| caps.contains(OPTION_SIDE_BAND_64K);
+
if (sideband) {
- try {
- sendPack(true, req, accumulator, allTags, unshallowCommits,
- deepenNots, pckOut);
- } catch (ServiceMayNotContinueException err) {
- String message = err.getMessage();
- if (message == null) {
- message = JGitText.get().internalServerError;
- }
- try {
- reportInternalServerErrorOverSideband(message);
- } catch (IOException e) {
- err.addSuppressed(e);
- throw err;
- }
- throw new UploadPackInternalServerErrorException(err);
- } catch (IOException | RuntimeException | Error err) {
- try {
- reportInternalServerErrorOverSideband(
- JGitText.get().internalServerError);
- } catch (IOException e) {
- err.addSuppressed(e);
- throw err;
- }
- throw new UploadPackInternalServerErrorException(err);
+ errOut = new SideBandErrorWriter();
+
+ int bufsz = SideBandOutputStream.SMALL_BUF;
+ if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K)) {
+ bufsz = SideBandOutputStream.MAX_BUF;
+ }
+ OutputStream packOut = new SideBandOutputStream(
+ SideBandOutputStream.CH_DATA, bufsz, rawOut);
+
+ ProgressMonitor pm = NullProgressMonitor.INSTANCE;
+ if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) {
+ msgOut = new SideBandOutputStream(
+ SideBandOutputStream.CH_PROGRESS, bufsz, rawOut);
+ pm = new SideBandProgressMonitor(msgOut);
}
+
+ sendPack(pm, pckOut, packOut, req, accumulator, allTags,
+ unshallowCommits, deepenNots);
+ pckOut.end();
} else {
- sendPack(false, req, accumulator, allTags, unshallowCommits, deepenNots,
- pckOut);
+ sendPack(NullProgressMonitor.INSTANCE, pckOut, rawOut, req,
+ accumulator, allTags, unshallowCommits, deepenNots);
}
}
- private void reportInternalServerErrorOverSideband(String message)
- throws IOException {
- @SuppressWarnings("resource" /* java 7 */)
- SideBandOutputStream err = new SideBandOutputStream(
- SideBandOutputStream.CH_ERROR, SideBandOutputStream.SMALL_BUF,
- rawOut);
- err.write(Constants.encode(message));
- err.flush();
- }
-
/**
* Send the requested objects to the client.
*
- * @param sideband
- * whether to wrap the pack in side-band pkt-lines, interleaved
- * with progress messages and errors.
+ * @param pm
+ * progress monitor
+ * @param pckOut
+ * PacketLineOut that shares the output with packOut
+ * @param packOut
+ * packfile output
* @param req
* request being processed
* @param accumulator
@@ -2173,35 +2190,14 @@ public class UploadPack {
* shallow commits on the client that are now becoming unshallow
* @param deepenNots
* objects that the client specified using --shallow-exclude
- * @param pckOut
- * output writer
* @throws IOException
* if an error occurred while generating or writing the pack.
*/
- private void sendPack(final boolean sideband,
- FetchRequest req,
+ private void sendPack(ProgressMonitor pm, PacketLineOut pckOut,
+ OutputStream packOut, FetchRequest req,
PackStatistics.Accumulator accumulator,
- @Nullable Collection<Ref> allTags,
- List<ObjectId> unshallowCommits,
- List<ObjectId> deepenNots,
- PacketLineOut pckOut) throws IOException {
- ProgressMonitor pm = NullProgressMonitor.INSTANCE;
- OutputStream packOut = rawOut;
-
- if (sideband) {
- int bufsz = SideBandOutputStream.SMALL_BUF;
- if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K))
- bufsz = SideBandOutputStream.MAX_BUF;
-
- packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA,
- bufsz, rawOut);
- if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) {
- msgOut = new SideBandOutputStream(
- SideBandOutputStream.CH_PROGRESS, bufsz, rawOut);
- pm = new SideBandProgressMonitor(msgOut);
- }
- }
-
+ @Nullable Collection<Ref> allTags, List<ObjectId> unshallowCommits,
+ List<ObjectId> deepenNots) throws IOException {
if (wantAll.isEmpty()) {
preUploadHook.onSendPack(this, wantIds, commonBase);
} else {
@@ -2344,9 +2340,6 @@ public class UploadPack {
}
pw.close();
}
-
- if (sideband)
- pckOut.end();
}
private static void findSymrefs(
@@ -2411,4 +2404,28 @@ public class UploadPack {
}
}
}
+
+ private interface ErrorWriter {
+ void writeError(String message) throws IOException;
+ }
+
+ private class SideBandErrorWriter implements ErrorWriter {
+ @Override
+ public void writeError(String message) throws IOException {
+ @SuppressWarnings("resource" /* java 7 */)
+ SideBandOutputStream err = new SideBandOutputStream(
+ SideBandOutputStream.CH_ERROR,
+ SideBandOutputStream.SMALL_BUF, requireNonNull(rawOut));
+ err.write(Constants.encode(message));
+ err.flush();
+ }
+ }
+
+ private class PackProtocolErrorWriter implements ErrorWriter {
+ @Override
+ public void writeError(String message) throws IOException {
+ new PacketLineOut(requireNonNull(rawOut))
+ .writeString("ERR " + message + '\n'); //$NON-NLS-1$
+ }
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java
index b4a7af094d..9a08c080c3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java
@@ -124,8 +124,8 @@ public class FileResolver<C> implements RepositoryResolver<C> {
// are responsible for closing the repository if we
// complete successfully.
return db;
- } else
- throw new ServiceNotEnabledException();
+ }
+ throw new ServiceNotEnabledException();
} catch (RuntimeException | IOException e) {
db.close();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index 4f3eb05b11..6969ae45af 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -285,9 +285,8 @@ public class FileTreeIterator extends WorkingTreeIterator {
} else if (attributes.isDirectory()) {
if (new File(f, Constants.DOT_GIT).exists()) {
return FileMode.GITLINK;
- } else {
- return FileMode.TREE;
}
+ return FileMode.TREE;
} else if (attributes.isExecutable()) {
return FileMode.EXECUTABLE_FILE;
} else {
@@ -425,9 +424,8 @@ public class FileTreeIterator extends WorkingTreeIterator {
if (attributes.isSymbolicLink()) {
return new ByteArrayInputStream(fs.readSymLink(getFile())
.getBytes(UTF_8));
- } else {
- return new FileInputStream(getFile());
}
+ return new FileInputStream(getFile());
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index 8bb68dca17..88b76f7121 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -101,7 +101,6 @@ import org.eclipse.jgit.util.Paths;
import org.eclipse.jgit.util.RawParseUtils;
import org.eclipse.jgit.util.TemporaryBuffer;
import org.eclipse.jgit.util.TemporaryBuffer.LocalFile;
-import org.eclipse.jgit.util.io.AutoLFInputStream;
import org.eclipse.jgit.util.io.EolStreamTypeUtil;
import org.eclipse.jgit.util.sha1.SHA1;
@@ -686,10 +685,10 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
public InputStream openEntryStream() throws IOException {
InputStream rawis = current().openInputStream();
if (getCleanFilterCommand() == null
- && getEolStreamType() == EolStreamType.DIRECT)
+ && getEolStreamType() == EolStreamType.DIRECT) {
return rawis;
- else
- return filterClean(rawis);
+ }
+ return filterClean(rawis);
}
/**
@@ -980,13 +979,13 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
MetadataDiff diff = compareMetadata(entry);
switch (diff) {
case DIFFER_BY_TIMESTAMP:
- if (forceContentCheck)
+ if (forceContentCheck) {
// But we are told to look at content even though timestamps
// tell us about modification
return contentCheck(entry, reader);
- else
- // We are told to assume a modification if timestamps differs
- return true;
+ }
+ // We are told to assume a modification if timestamps differs
+ return true;
case SMUDGED:
// The file is clean by timestamps but the entry was smudged.
// Lets do a content check
@@ -1087,47 +1086,13 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
entry.setLength((int) getEntryLength());
return false;
- } else {
- if (mode == FileMode.SYMLINK.getBits()) {
- return !new File(readSymlinkTarget(current())).equals(
- new File(readContentAsNormalizedString(entry, reader)));
- }
- // Content differs: that's a real change, perhaps
- if (reader == null) // deprecated use, do no further checks
- return true;
-
- switch (getEolStreamType()) {
- case DIRECT:
- return true;
- default:
- try {
- ObjectLoader loader = reader.open(entry.getObjectId());
- if (loader == null)
- return true;
-
- // We need to compute the length, but only if it is not
- // a binary stream.
- long dcInLen;
- try (InputStream dcIn = new AutoLFInputStream(
- loader.openStream(), true,
- true /* abort if binary */)) {
- dcInLen = computeLength(dcIn);
- } catch (AutoLFInputStream.IsBinaryException e) {
- return true;
- }
-
- try (InputStream dcIn = new AutoLFInputStream(
- loader.openStream(), true)) {
- byte[] autoCrLfHash = computeHash(dcIn, dcInLen);
- boolean changed = getEntryObjectId()
- .compareTo(autoCrLfHash, 0) != 0;
- return changed;
- }
- } catch (IOException e) {
- return true;
- }
- }
}
+ if (mode == FileMode.SYMLINK.getBits()) {
+ return !new File(readSymlinkTarget(current())).equals(
+ new File(readContentAsNormalizedString(entry, reader)));
+ }
+ // Content differs: that's a real change
+ return true;
}
private static String readContentAsNormalizedString(DirCacheEntry entry,
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java
index 6cca582b3b..52fb888291 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java
@@ -212,10 +212,9 @@ public class IndexDiffFilter extends TreeFilter {
// If i is cnt then the path does not appear in any other tree,
// and this working tree entry can be safely ignored.
return i != cnt;
- } else {
- // In working tree and not ignored, and not in DirCache.
- return true;
}
+ // In working tree and not ignored, and not in DirCache.
+ return true;
}
// Always include subtrees as WorkingTreeIterator cannot provide
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
index 3d9f875e99..11896e4242 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
@@ -99,10 +99,10 @@ public class PathSuffixFilter extends TreeFilter {
@Override
public boolean include(TreeWalk walker) throws MissingObjectException,
IncorrectObjectTypeException, IOException {
- if (walker.isSubtree())
+ if (walker.isSubtree()) {
return true;
- else
- return walker.isPathSuffix(pathRaw, pathRaw.length);
+ }
+ return walker.isPathSuffix(pathRaw, pathRaw.length);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
index c8e6645f57..66f996554f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java
@@ -173,20 +173,19 @@ public class ChangeIdUtil {
boolean replaceExisting) {
int indexOfChangeId = indexOfChangeId(message, "\n"); //$NON-NLS-1$
if (indexOfChangeId > 0) {
- if (!replaceExisting)
+ if (!replaceExisting) {
return message;
- else {
- StringBuilder ret = new StringBuilder(message.substring(0,
- indexOfChangeId));
- ret.append(CHANGE_ID);
- ret.append(" I"); //$NON-NLS-1$
- ret.append(ObjectId.toString(changeId));
- int indexOfNextLineBreak = message.indexOf("\n", //$NON-NLS-1$
- indexOfChangeId);
- if (indexOfNextLineBreak > 0)
- ret.append(message.substring(indexOfNextLineBreak));
- return ret.toString();
}
+ StringBuilder ret = new StringBuilder(
+ message.substring(0, indexOfChangeId));
+ ret.append(CHANGE_ID);
+ ret.append(" I"); //$NON-NLS-1$
+ ret.append(ObjectId.toString(changeId));
+ int indexOfNextLineBreak = message.indexOf("\n", //$NON-NLS-1$
+ indexOfChangeId);
+ if (indexOfNextLineBreak > 0)
+ ret.append(message.substring(indexOfNextLineBreak));
+ return ret.toString();
}
String[] lines = message.split("\n"); //$NON-NLS-1$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
index 29519298c4..2035ada809 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java
@@ -61,6 +61,7 @@ import java.nio.charset.Charset;
import java.nio.file.AccessDeniedException;
import java.nio.file.FileStore;
import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
@@ -98,6 +99,7 @@ import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.errors.LockFailedException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.file.FileSnapshot;
+import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
@@ -147,15 +149,15 @@ public abstract class FS {
*/
public FS detect(Boolean cygwinUsed) {
if (SystemReader.getInstance().isWindows()) {
- if (cygwinUsed == null)
+ if (cygwinUsed == null) {
cygwinUsed = Boolean.valueOf(FS_Win32_Cygwin.isCygwin());
- if (cygwinUsed.booleanValue())
+ }
+ if (cygwinUsed.booleanValue()) {
return new FS_Win32_Cygwin();
- else
- return new FS_Win32();
- } else {
- return new FS_POSIX();
+ }
+ return new FS_Win32();
}
+ return new FS_POSIX();
}
}
@@ -842,7 +844,7 @@ public abstract class FS {
try {
FileUtils.delete(tempFile);
} catch (IOException e) {
- throw new RuntimeException(e); // panic
+ LOG.error(JGitText.get().cannotDeleteFile, tempFile);
}
}
}
@@ -1197,14 +1199,13 @@ public abstract class FS {
gobbler.join();
if (rc == 0 && !gobbler.fail.get()) {
return r;
- } else {
- if (debug) {
- LOG.debug("readpipe rc=" + rc); //$NON-NLS-1$
- }
- throw new CommandFailedException(rc,
- gobbler.errorMessage.get(),
- gobbler.exception.get());
}
+ if (debug) {
+ LOG.debug("readpipe rc=" + rc); //$NON-NLS-1$
+ }
+ throw new CommandFailedException(rc,
+ gobbler.errorMessage.get(),
+ gobbler.exception.get());
} catch (InterruptedException ie) {
// Stop bothering me, I have a zombie to reap.
}
@@ -1731,20 +1732,18 @@ public abstract class FS {
final String hookName, String[] args, PrintStream outRedirect,
PrintStream errRedirect, String stdinArgs)
throws JGitInternalException {
- final File hookFile = findHook(repository, hookName);
- if (hookFile == null)
+ File hookFile = findHook(repository, hookName);
+ if (hookFile == null || hookName == null) {
return new ProcessResult(Status.NOT_PRESENT);
+ }
- final String hookPath = hookFile.getAbsolutePath();
- final File runDirectory;
- if (repository.isBare())
- runDirectory = repository.getDirectory();
- else
- runDirectory = repository.getWorkTree();
- final String cmd = relativize(runDirectory.getAbsolutePath(),
- hookPath);
+ File runDirectory = getRunDirectory(repository, hookName);
+ if (runDirectory == null) {
+ return new ProcessResult(Status.NOT_PRESENT);
+ }
+ String cmd = hookFile.getAbsolutePath();
ProcessBuilder hookProcess = runInShell(cmd, args);
- hookProcess.directory(runDirectory);
+ hookProcess.directory(runDirectory.getAbsoluteFile());
Map<String, String> environment = hookProcess.environment();
environment.put(Constants.GIT_DIR_KEY,
repository.getDirectory().getAbsolutePath());
@@ -1779,12 +1778,71 @@ public abstract class FS {
* @since 4.0
*/
public File findHook(Repository repository, String hookName) {
- File gitDir = repository.getDirectory();
- if (gitDir == null)
+ if (hookName == null) {
+ return null;
+ }
+ File hookDir = getHooksDirectory(repository);
+ if (hookDir == null) {
return null;
- final File hookFile = new File(new File(gitDir,
- Constants.HOOKS), hookName);
- return hookFile.isFile() ? hookFile : null;
+ }
+ File hookFile = new File(hookDir, hookName);
+ if (hookFile.isAbsolute()) {
+ if (!hookFile.exists() || (FS.DETECTED.supportsExecute()
+ && !FS.DETECTED.canExecute(hookFile))) {
+ return null;
+ }
+ } else {
+ try {
+ File runDirectory = getRunDirectory(repository, hookName);
+ if (runDirectory == null) {
+ return null;
+ }
+ Path hookPath = runDirectory.getAbsoluteFile().toPath()
+ .resolve(hookFile.toPath());
+ FS fs = repository.getFS();
+ if (fs == null) {
+ fs = FS.DETECTED;
+ }
+ if (!Files.exists(hookPath) || (fs.supportsExecute()
+ && !fs.canExecute(hookPath.toFile()))) {
+ return null;
+ }
+ hookFile = hookPath.toFile();
+ } catch (InvalidPathException e) {
+ LOG.warn(MessageFormat.format(JGitText.get().invalidHooksPath,
+ hookFile));
+ return null;
+ }
+ }
+ return hookFile;
+ }
+
+ private File getRunDirectory(Repository repository,
+ @NonNull String hookName) {
+ if (repository.isBare()) {
+ return repository.getDirectory();
+ }
+ switch (hookName) {
+ case "pre-receive": //$NON-NLS-1$
+ case "update": //$NON-NLS-1$
+ case "post-receive": //$NON-NLS-1$
+ case "post-update": //$NON-NLS-1$
+ case "push-to-checkout": //$NON-NLS-1$
+ return repository.getDirectory();
+ default:
+ return repository.getWorkTree();
+ }
+ }
+
+ private File getHooksDirectory(Repository repository) {
+ Config config = repository.getConfig();
+ String hooksDir = config.getString(ConfigConstants.CONFIG_CORE_SECTION,
+ null, ConfigConstants.CONFIG_KEY_HOOKS_PATH);
+ if (hooksDir != null) {
+ return new File(hooksDir);
+ }
+ File dir = repository.getDirectory();
+ return dir == null ? null : new File(dir, Constants.HOOKS);
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
index 6a1eef2d66..7c170ac4eb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java
@@ -74,7 +74,6 @@ import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.errors.CommandFailedException;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.internal.JGitText;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.slf4j.Logger;
@@ -311,20 +310,6 @@ public class FS_POSIX extends FS {
/** {@inheritDoc} */
@Override
- public File findHook(Repository repository, String hookName) {
- final File gitdir = repository.getDirectory();
- if (gitdir == null) {
- return null;
- }
- final Path hookPath = gitdir.toPath().resolve(Constants.HOOKS)
- .resolve(hookName);
- if (Files.isExecutable(hookPath))
- return hookPath.toFile();
- return null;
- }
-
- /** {@inheritDoc} */
- @Override
public boolean supportsAtomicCreateNewFile() {
if (supportsAtomicFileCreation == AtomicFileCreation.UNDEFINED) {
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
index 9a163e8e38..4efa9888f7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java
@@ -47,8 +47,6 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.File;
import java.io.PrintStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
@@ -57,7 +55,6 @@ import java.util.List;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.errors.CommandFailedException;
-import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Repository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -175,18 +172,4 @@ public class FS_Win32_Cygwin extends FS_Win32 {
return internalRunHookIfPresent(repository, hookName, args, outRedirect,
errRedirect, stdinArgs);
}
-
- /** {@inheritDoc} */
- @Override
- public File findHook(Repository repository, String hookName) {
- final File gitdir = repository.getDirectory();
- if (gitdir == null) {
- return null;
- }
- final Path hookPath = gitdir.toPath().resolve(Constants.HOOKS)
- .resolve(hookName);
- if (Files.isExecutable(hookPath))
- return hookPath.toFile();
- return null;
- }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
index 640670debc..d897255062 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
@@ -51,6 +51,7 @@ import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.Proxy;
import java.net.ProxySelector;
+import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
@@ -299,7 +300,9 @@ public class HttpSupport {
public static Proxy proxyFor(ProxySelector proxySelector, URL u)
throws ConnectException {
try {
- return proxySelector.select(u.toURI()).get(0);
+ URI uri = new URI(u.getProtocol(), null, u.getHost(), u.getPort(),
+ null, null, null);
+ return proxySelector.select(uri).get(0);
} catch (URISyntaxException e) {
final ConnectException err;
err = new ConnectException(MessageFormat.format(JGitText.get().cannotDetermineProxyFor, u));
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
index a07a4fd1a5..391598d8ae 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
@@ -345,13 +345,14 @@ public class IO {
c = s.charAt(++i);
l.add(sb.toString());
sb.setLength(0);
- if (c != '\n')
+ if (c != '\n') {
sb.append(c);
+ }
continue;
- } else { // EOF
- l.add(sb.toString());
- break;
}
+ // EOF
+ l.add(sb.toString());
+ break;
}
sb.append(c);
}
@@ -401,20 +402,18 @@ public class IO {
}
resetAndSkipFully(in, n);
}
- } else {
- StringBuilder buf = sizeHint > 0
- ? new StringBuilder(sizeHint)
- : new StringBuilder();
- int i;
- while ((i = in.read()) != -1) {
- char c = (char) i;
- buf.append(c);
- if (c == '\n') {
- break;
- }
+ }
+ StringBuilder buf = sizeHint > 0 ? new StringBuilder(sizeHint)
+ : new StringBuilder();
+ int i;
+ while ((i = in.read()) != -1) {
+ char c = (char) i;
+ buf.append(c);
+ if (c == '\n') {
+ break;
}
- return buf.toString();
}
+ return buf.toString();
}
private static void resetAndSkipFully(Reader fd, long toSkip) throws IOException {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java
index 9663e3cef5..ce1308f334 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefMap.java
@@ -191,12 +191,11 @@ public class RefMap extends AbstractMap<String, Ref> {
Ref prior = loose.get(name);
loose = loose.set(idx, value);
return prior;
- } else {
- Ref prior = get(keyName);
- loose = loose.add(idx, value);
- sizeIsValid = false;
- return prior;
}
+ Ref prior = get(keyName);
+ loose = loose.add(idx, value);
+ sizeIsValid = false;
+ return prior;
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java
index 913aa72867..84db786b16 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SshSupport.java
@@ -109,9 +109,8 @@ public class SshSupport {
// wrong exception type :(
if (process.waitFor() == 0) {
return stdout.toString();
- } else {
- return null; // still running after timeout
}
+ return null; // still running after timeout
} catch (InterruptedException e) {
return null; // error
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java
index 9ab2caa1ac..e437c1114b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java
@@ -98,15 +98,16 @@ public abstract class LimitedInputStream extends FilterInputStream {
@Override
public int read() throws IOException {
if (left == 0) {
- if (in.available() == 0)
+ if (in.available() == 0) {
return -1;
- else
- limitExceeded();
+ }
+ limitExceeded();
}
int result = in.read();
- if (result != -1)
+ if (result != -1) {
--left;
+ }
return result;
}
@@ -114,16 +115,17 @@ public abstract class LimitedInputStream extends FilterInputStream {
@Override
public int read(byte[] b, int off, int len) throws IOException {
if (left == 0) {
- if (in.available() == 0)
+ if (in.available() == 0) {
return -1;
- else
- limitExceeded();
+ }
+ limitExceeded();
}
len = (int) Math.min(len, left);
int result = in.read(b, off, len);
- if (result != -1)
+ if (result != -1) {
left -= result;
+ }
return result;
}
diff --git a/pom.xml b/pom.xml
index cd4795ba7a..43d09559a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,7 +51,7 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit-parent</artifactId>
<packaging>pom</packaging>
- <version>5.5.2-SNAPSHOT</version>
+ <version>5.6.0-SNAPSHOT</version>
<name>JGit - Parent</name>
<url>${jgit-url}</url>
@@ -193,14 +193,14 @@
<commons-compress-version>1.18</commons-compress-version>
<osgi-core-version>4.3.1</osgi-core-version>
<servlet-api-version>3.1.0</servlet-api-version>
- <jetty-version>9.4.20.v20190813</jetty-version>
+ <jetty-version>9.4.22.v20191022</jetty-version>
<japicmp-version>0.14.1</japicmp-version>
<httpclient-version>4.5.6</httpclient-version>
<httpcore-version>4.4.10</httpcore-version>
<slf4j-version>1.7.2</slf4j-version>
<log4j-version>1.2.15</log4j-version>
<maven-javadoc-plugin-version>3.1.1</maven-javadoc-plugin-version>
- <tycho-extras-version>1.4.0</tycho-extras-version>
+ <tycho-extras-version>1.5.1</tycho-extras-version>
<gson-version>2.8.2</gson-version>
<bouncycastle-version>1.61</bouncycastle-version>
<spotbugs-maven-plugin-version>3.1.12.2</spotbugs-maven-plugin-version>
@@ -352,7 +352,7 @@
<plugin>
<groupId>org.eclipse.cbi.maven.plugins</groupId>
<artifactId>eclipse-jarsigner-plugin</artifactId>
- <version>1.1.6</version>
+ <version>1.1.7</version>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
@@ -367,7 +367,7 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
- <version>0.8.4</version>
+ <version>0.8.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -438,7 +438,7 @@
<configuration>
<rules>
<requireMavenVersion>
- <version>3.5.2</version>
+ <version>3.6.2</version>
</requireMavenVersion>
</rules>
</configuration>
@@ -926,7 +926,7 @@
<dependency>
<groupId>org.eclipse.jdt</groupId>
<artifactId>ecj</artifactId>
- <version>3.18.0</version>
+ <version>3.19.0</version>
</dependency>
</dependencies>
</plugin>
diff --git a/tools/bazelisk_version.bzl b/tools/bazelisk_version.bzl
new file mode 100644
index 0000000000..d8b3d10982
--- /dev/null
+++ b/tools/bazelisk_version.bzl
@@ -0,0 +1,16 @@
+_template = """
+load("@bazel_skylib//lib:versions.bzl", "versions")
+
+def check_bazel_version():
+ versions.check(minimum_bazel_version = "{version}")
+""".strip()
+
+def _impl(repository_ctx):
+ repository_ctx.symlink(Label("@//:.bazelversion"), ".bazelversion")
+ bazelversion = repository_ctx.read(".bazelversion").strip()
+
+ repository_ctx.file("BUILD", executable = False)
+
+ repository_ctx.file("check.bzl", executable = False, content = _template.format(version = bazelversion))
+
+bazelisk_version = repository_rule(implementation = _impl)