aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* WorkingTreeModifiedEvent: must be fired explicitly after mergeThomas Wolf2019-11-032-9/+39
| | | | | | | | | | | | A merge may write files to the working tree. After a successful merge one must fire a WorkingTreeModifiedEvent explicitly if getModifiedFiles() is not empty. Also, any touched files must be reported by the WorkingTreeModifiedEvent fired by DirCacheCheckout.checkout(). Bug: 552636 Change-Id: I5fab8279ed8be8a4ae34cddfa726836b9277aea6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge "HttpSupport.proxyFor(): use only scheme, host, and port"David Pursehouse2019-10-301-0/+69
|\
| * HttpSupport.proxyFor(): use only scheme, host, and portThomas Wolf2019-10-301-0/+69
| | | | | | | | | | | | | | | | | | Some URLs cannot be converted via URL.toURI(). So don't convert the full URL but only the bits that are needed to find a proxy via java.net.ProxySelector. Bug: 549690 Change-Id: I55b5ecee70c6b52f72f9bdba9ce552fde7f33976 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | reftable: enforce ascending order in sortAndWriteRefsHan-Wen Nienhuys2019-10-302-27/+6
|/ | | | | | | | | | | | | | | | | | | MergedReftableTest#scanDuplicates tests whether we can write duplicate keys in a merged reftable. Apparently, the first key appearing should get precedence, and this works because the sort() algorithm on ordered collections is stable. This is potentially confusing behavior, because you can write data into the table that cannot be retrieved (Merged table can only have one entry per key), and the APIs such as exactRef() only return a single value. Make this consistent with behavior introduced in I04f55c481 "reftable: enforce ordering for ref and log writes" by considering a duplicate key in sortAndWriteRefs as a fatal runtime error. Change-Id: I1eedd18f028180069f78c5c467169dcfe1521157 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* GPG: implement more OpenPGP UserId matching formatsThomas Wolf2019-10-231-0/+167
| | | | | | | | | | | | | | | | | | | | | Instead of just looking for a substring match of user.signingKey in a key's user ID implement the GPG matching formats[1] for: '=' Full exact match '<' Full exact match of the e-mail address '@' Substring match within the e-mail address only '*' General case-insensitive substring match (default) When user.signingKey is not set, the committer's e-mail address is used by default. In that case, use '<', i.e., require an exact match on the OpenPGP e-mail address. Also handle the optional "0x" prefix for (partial) key fingerprints. [1] https://www.gnupg.org/documentation/manuals/gnupg/Specify-a-User-ID.html Bug: 550335 Change-Id: I6ce482a099ff1a0dc9de45435cd4d3ec5b504f12 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge "TreeRevFilterTest: Simplify filter used"Jonathan Tan2019-10-221-17/+7
|\
| * TreeRevFilterTest: Simplify filter usedJonathan Tan2019-10-221-17/+7
| | | | | | | | | | | | | | | | | | | | TreeRevFilterTest uses an unncessarily complicated TreeFilter - an AndTreeFilter - when it should be as simple as possible because this class tests TreeRevFilter, not AndTreeFilter. Replace the filter with a simpler one. Change-Id: I3256a65f6e0042d32fd76a9224b79a835674ff3a Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
* | Support for core.hooksPathThomas Wolf2019-10-211-0/+71
|/ | | | | | | | | Support the core.hooksPath git config. This can be an absolute or relative path of a directory where to find git hooks; a relative path is resolved relative to the directory the hook will run in. Bug: 500266 Change-Id: I671999a6386a837e897c31718583c91d8035f3ba Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Close ObjectReaders in testsThomas Wolf2019-10-214-120/+145
| | | | Change-Id: Ic839af4f85861fb48091d45679e2a614f001d770 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Close some Repository instances in testsThomas Wolf2019-10-216-167/+182
| | | | | | | This doesn't yet ensure that _all_ repositories are closed. It only handles the obvious, local, and easy cases. Change-Id: I0f9f8607791f0f03ed1f5ad71e9595e78b78892f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Close ObjectInserters in testsThomas Wolf2019-10-214-55/+67
| | | | Change-Id: I0048a9ae23aee79cfecafb15855c63cd92818c57 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Remove meaningless comment in CloneCommandTestMatthias Sohn2019-10-211-1/+0
| | | | | | | | This comment was probably copied from testCloneRepositoryWithBranch() to testBareCloneRepositoryOnlyOneBranch() where it doesn't make sense. Hence remove it. Change-Id: I846debd084dd77fd473c3602a799f195a8390f77 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Implement mirror option in CloneCommandMatthias Sohn2019-10-211-1/+33
| | | | | Bug: 552173 Change-Id: If79adf578b303890314a3285d7a6d2c71f48d091 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable and fix "Statement unnecessarily nested within else clause" warningsDavid Pursehouse2019-10-175-29/+17
| | | | | | | | | | | | | | | Since [1] the gerrit project includes jgit as a submodule, and has this warning enabled, resulting in 100s of warnings in the console. Also enable the warning here, and fix them. At the same time, add missing braces around adjacent and nearby one-line blocks. [1] https://gerrit-review.googlesource.com/c/gerrit/+/227897 Change-Id: I81df3fc7ed6eedf6874ce1a3bedfa727a1897e4c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Close RevWalks in testsThomas Wolf2019-10-167-380/+443
| | | | Change-Id: Id28804ace2572e8f659271660e78454a0d6ccc49 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge "reftable: fix lookup by ID in merged reftables"Jonathan Tan2019-10-161-0/+13
|\
| * reftable: fix lookup by ID in merged reftablesHan-Wen Nienhuys2019-10-161-0/+13
| | | | | | | | | | | | | | | | | | | | On changing a ref, the old SHA1 is not updated in the object => ref mapping. This means search by object ID may still turn up a ref from deeper within the stack. To fix this, check all refs produced by the merged iterator against the merged reftables. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: I41e9cd395b0608eedeeaead0a9fd997238d747c9
* | Merge changes I6e022e4a,If1b9d808David Pursehouse2019-10-1520-916/+1041
|\ \ | | | | | | | | | | | | | | | * changes: Close TreeWalks in tests Close SubmoduleWalks in tests
| * | Close TreeWalks in testsThomas Wolf2019-10-1511-600/+689
| | | | | | | | | | | | | | | | | | | | | Note that TreeWalk.forPath() needs not be closed; the ObjectReader _is_ closed when that method returns. Change-Id: I6e022e4a2fde0c88d610a82de092ea541b33f75c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| * | Close SubmoduleWalks in testsThomas Wolf2019-10-159-316/+352
| |/ | | | | | | Change-Id: If1b9d80830b6b136d4ab33f5c7043b140bd92f85 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* / ProtocolV2Parser: Introduce advertise sideband-all optionIvan Frade2019-10-151-2/+5
|/ | | | | | | | | | | | | | | | The flag enabling sideband-all is used in two places: in UploadPack for advertisement and in the protocol parser to read it from the request. This leds to problems in distributed deployments where the two requests of a fetch can go to different servers with different configurations. Use the existing allowsidebandall to accept the sideband-all request (and respond to it) and introduce a new "advertisesidebandall" to toggle the advertising of the feature. Change-Id: I892d541bc3f321606c89bad1d333b079dce6b5fa Signed-off-by: Ivan Frade <ifrade@google.com>
* CachedPackUriProvider: Add size to the pack informationIvan Frade2019-10-111-1/+1
| | | | | | | | | | | | The object identifying packfiles to send them via packfile-uri contains only the uri and the hash. This is the information that goes through the wire. It would be useful to know also the size of those packfile, for example to track how many bytes have been offloaded to HTTP. Add size field the CachedPackUriProvider.PackInfo object. Change-Id: If6b921b48a4764d936141c777879b148cc80bbd3 Signed-off-by: Ivan Frade <ifrade@google.com>
* UploadPackTest: Stop using deprecated PacketLineIn constantsDavid Pursehouse2019-10-071-6/+6
| | | | | | | | The DELIM and END constants are deprecated and using them causes warnings. Replace them with the accessor methods. Change-Id: Iadb27000755e8fd8c61d9218591f9d110b8265c8 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix parsing of core.logAllRefUpdatesThomas Wolf2019-10-071-3/+25
| | | | | | | | | | Also correctly parse the "always" value (allowed in canonical git since git 2.12.0[1]). Adapt the ReflogWriter. [1] https://github.com/git/git/commit/341fb2862 Bug: 551664 Change-Id: I051c76ca355a2ac8d6092de65f44b18bf9aeb125 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* reftable: move AutoCloseable to ReftableReaderHan-Wen Nienhuys2019-09-271-1/+1
| | | | | | | | | | | | MergedReftable is not used as an AutoCloseable, because closing tables is currently handled by DfsReftableStack#close. Encode that a MergedReftable is a list of ReftableReaders. The previous code suggested that we could form nested trees of MergedReftables, which is not how we use reftables. Change-Id: Icbe2fee8a5a12373f45fc5f97d8b1a2b14231c96 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Fire WorkingTreeModifiedEvent if cherry-pick failed with conflictsMatthias Sohn2019-09-261-0/+21
| | | | | | | | Otherwise the paths modified by a cherry-pick with conflicts won't be reported as modified via WorkingTreeModifiedEvents. Change-Id: I875b67c0d2f68efdf90a9c32b80a2e074ed3570d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* reftable: pass OutputStream at construction timeHan-Wen Nienhuys2019-09-204-76/+82
| | | | | | | | | | This makes the intended use of the classes more clear. It also simplifies generic functions that write reftables: they only need a ReftableWriter as argument, as the stream is carried within the ReftableWriter. Change-Id: Idbb06f89ae33100f0c0b562cc38e5b3b026d5181 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* UploadPackReachabilityTest: Use assertThrows instead of thrownIvan Frade2019-09-181-15/+14
| | | | | | | | | | | In https://git.eclipse.org/r/c/144009/ UploadPack tests moved from thrown to assertThrows, but newly introduced tests are still using the thrown. Update test so all of them use assertThrows. Change-Id: I0ff19a6f8ba9e978d8ffc7a912c0572d9f00c7fa Signed-off-by: Ivan Frade <ifrade@google.com>
* RequestValidatorTestCase: Tests for the request validatorsIvan Frade2019-09-184-0/+598
| | | | | | | | | | | | Make a general test with all the cases, like request advertised/unadvertised tips, reachable/unreachable from those tips, commits/blobs. Implement specific validator tests as subclasses. Each test provides the validator instance and tells what cases are valid. Change-Id: I7f961fcc05f7fabbeae1ba8ff73d99072ce8fc72 Signed-off-by: Ivan Frade <ifrade@google.com>
* UploadPackTest: Move "reachability" tests to its own fileIvan Frade2019-09-182-97/+317
| | | | | | | | | | | | | | UploadPackTest is already too long and it is covering too many aspects of UploadPack. This makes difficult to see what is tests and if all cases are covered. Move the reachability-related tests to its own file. This moves also an auxiliary function, reducing the length of UploadPack. Complete also the coverage, adding combinations of bitmap availability/commits or blobs/reachable or not. Change-Id: Id5cfc9d0118d997da30e3886c91db996a86250fc Signed-off-by: Ivan Frade <ifrade@google.com>
* Merge branch 'stable-5.5'Matthias Sohn2019-09-171-0/+182
|\ | | | | | | | | | | | | | | * stable-5.5: WorkingTreeIterator: handle different timestamp resolutions Change-Id: I61df7392d8826ab526c39da2a8718723a1cc602a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-5.4' into stable-5.5Matthias Sohn2019-09-171-0/+182
| |\ | | | | | | | | | | | | | | | | | | | | | * stable-5.4: WorkingTreeIterator: handle different timestamp resolutions Change-Id: I83384336e0d766237d0579152673c9eefc9edd65 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-09-171-0/+182
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: WorkingTreeIterator: handle different timestamp resolutions Change-Id: I87afe29578b0270c79bc54c4e2cfda579c329237 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-09-171-0/+182
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: WorkingTreeIterator: handle different timestamp resolutions Change-Id: Ia2a38949089a66abb5f4f1cd41717d2ae8d0eb5b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-09-171-0/+182
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: WorkingTreeIterator: handle different timestamp resolutions Change-Id: Ic33ebec963af03a182dfe8f46486f5e8d00c0694 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * WorkingTreeIterator: handle different timestamp resolutionsThomas Wolf2019-09-171-0/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Older JGit stored only milliseconds timestamps in the index. Newer JGit may get finer timestamps from the file system. This leads to slow index diffs when a new JGit runs against an index produced by older JGit because many timestamps will differ and JGit will then do many content checks. See [1]. Handle this migration case by only comparing milliseconds if the index entry has only millisecond precision. The inverse may also occur; also compare only milliseconds if the file timestamp has only millisecond precision. Do the same also for microsecond resolution. On Windows, NTFS may provide 100ns resolution and may be used by external programs writing the index, but Java's WindowsFileAttributes may provide only microseconds. File timestamp precision in Java depends not only on the Java APIs used by different JGit versions but may also change when running the same Java code on different VMs. And of course the resolution may vary among operating and file systems. Moreover, timestamp precision in the index depends on the program that wrote the index. Canonical git may use a different resolution, maybe even different between git versions. [1] https://www.eclipse.org/forums/index.php/t/1100344/ Change-Id: Idfd08606c883cb98787b2138f9baf0cc89a57b56 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | reftable: read file footer in ReftableReader#allRefsHan-Wen Nienhuys2019-09-111-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | allRefs determined the end of the ref block without accounting for index or log blocks. This could cause other blocks to be interpreted as ref blocks, leading to "invalid block" error messages. Change-Id: I7b9323e7d5e0e7d64535b3ec1efd576aed1e9870 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* | | | | | reftable: add ReftableReflogReaderHan-Wen Nienhuys2019-09-111-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Iac2c4ac5e3aad0fa37157ed8866f1987d80268d6 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* | | | | | ReceivePack: Prevent pointing a branch to a non-commit objectYunjie Li2019-09-062-24/+24
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit c3b0dec509fe136c5417422f31898b5a4e2d5e02, Git has disallowed writing a non-commit to refs/heads/* refs. JGit still allows that, which can put users in a bad situation. For example, git push origin v1.0:master pushes the tag object v1.0 to refs/heads/master, instead of the intended commit object v1.0^{commit}. Prevent that by validating that the target of the ref points to a commit object when pushing to refs/heads/*. Git performs the same check at a lower level (in the RefDatabase). We could do the same here, but for now let's start conservatively by handling it in pushes first. [jn: fleshed out commit message] Change-Id: I8f98ae6d8acbcd5ef7553ec732bc096cb6eb7c4e Signed-off-by: Yunjie Li <yunjieli@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | Merge branch 'stable-5.4' into stable-5.5Matthias Sohn2019-09-041-0/+29
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.4: Prepare 5.4.4-SNAPSHOT builds JGit v5.4.3.201909031940-r Prepare 5.3.6-SNAPSHOT builds JGit v5.3.5.201909031855-r Prepare 5.1.12-SNAPSHOT builds JGit v5.1.11.201909031202-r Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: Icd6630db6458971f840c3ab4553e00f6c775ede0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | | | Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2019-09-041-0/+29
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Prepare 5.3.6-SNAPSHOT builds JGit v5.3.5.201909031855-r Prepare 5.1.12-SNAPSHOT builds JGit v5.1.11.201909031202-r Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: Icfd5a612055feeff04733c0d2c44837ab554a2c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | | Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-09-041-0/+29
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.1.12-SNAPSHOT builds JGit v5.1.11.201909031202-r Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: I7e88c7c7d202f1e3fb8e143277650aa5fefff439 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-09-041-0/+29
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Prepare 5.1.12-SNAPSHOT builds JGit v5.1.11.201909031202-r Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: Iac5dc9683cea97db04d20f27c10f2e103d3ae7b5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-5.0' into stable-5.1Matthias Sohn2019-09-031-0/+29
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: I172136a031ff0730e575327cafb3527c9650a71d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-4.11' into stable-5.0stable-5.0Matthias Sohn2019-09-033-203/+69
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.10-SNAPSHOT builds JGit v4.11.9.201909030838-r Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: Ifb6a4dbea2f48fd2ffa66eb737d61920aefedfbd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2019-09-033-203/+69
| | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Bazel: Update bazlets to the latest master revision Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: If672b4f0c350f4e8ff7e1e706485cffd8137236d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2019-09-033-203/+69
| | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: BatchRefUpdate: repro racy atomic update, and fix it Delete unused FileTreeIteratorWithTimeControl Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Silence API warnings Change-Id: Id5bf44645655fca40ad22bb1f1ad20a7c2e8f6db Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | * BatchRefUpdate: repro racy atomic update, and fix itHan-Wen Nienhuys2019-09-031-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PackedBatchRefUpdate was creating a new packed-refs list that was potentially unsorted. This would be papered over when the list was read back from disk in parsePackedRef, which detects unsorted ref lists on reading, and sorts them. However, the BatchRefUpdate also installed the new (unsorted) list in-memory in RefDirectory#packedRefs. With the timestamp granularity code committed to stable-5.1, we can more often accurately decide that the packed-refs file is clean, and will return the erroneous unsorted data more often. Unluckily timed delays also cause the file to be clean, hence this problem was exacerbated under load. The symptom is that refs added by a BatchRefUpdate would stop being visible directly after they were added. In particular, the Gerrit integration tests uses BatchRefUpdate in its setup for creating the Admin group, and then tries to read it out directly afterward. The tests recreates one failure case. A better approach would be to revise RefList.Builder, so it detects out-of-order lists and automatically sorts them. Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=548716 and https://bugs.chromium.org/p/gerrit/issues/detail?id=11373. Bug: 548716 Change-Id: I613c8059964513ce2370543620725b540b3cb6d1 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | * Delete unused FileTreeIteratorWithTimeControlMatthias Sohn2019-09-032-177/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only usage of this test iterator was removed in df637928d. Hence delete this iterator and associated test. Change-Id: I47710133ec3edc675c21db210960c024982668c6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> (cherry picked from commit a024759cf5bf1cd6b9beb4f790d484943761a7e1)
| | | | | | | | * Fix RacyGitTests#testRacyGitDetectionMatthias Sohn2019-09-031-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test case assumed file system timestamp resolution of 1 second. On filesystems with a finer resolution this test fails since the index entry is only smudged if the file index entry's lastModified and the lastModified of the git index itself are within the same filesystem timer tick. Fix this by ensuring that these timestamps are identical which should work for any filesystem timer resolution. Bug: 548188 Change-Id: Id84d59e1cfeb48fa008f8f27f2f892c4f73985de Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> (cherry picked from commit 1159f9dd7c80a53c2509cd75d997a6afed37f9a6)