aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | | CommitBuilder: Deprecate setEncoding(String)David Pursehouse2019-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecate the method in favor of setEncoding(Charset). Update the only caller in the code base that was still using the deprecated variant. Change-Id: I6357f2d0c727007013c72e9d5b7c72a3f5f3f2b1 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | Fix bug in copyPackBypassCache's skip 'PACK' header logicMinh Thai2019-02-131-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug caused the pack to be 12 bytes short when cold cache. Also added test for copyPackAsIs method. Change-Id: Idf8fb0e50d1215245d4b032e2e00df4b218c115f Signed-off-by: Minh Thai <mthai@google.com>
* | | | | | | Fix GC.deleteEmptyRefsFoldersMatthias Sohn2019-01-281-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method tried to iterate spurious files which may exist in the .git/refs folder, e.g. on Mac a .DS_Store may have been created there by inspecting the folder using the finder application. This led to a NotDirectoryException when deleteEmptyRefsFolders tried to create an iterator for such a file entry. Skip files contained in the refs folder to ensure the method only tries to iterate contained folders but not files. Change-Id: I5f31e733072a35db1e93908a9c69a8891ae5c206 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Enable cloning only specific tagsThomas Wolf2019-01-271-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Single-branch-clone should be able to clone a single tag. Enhance CloneCommand to accept also full refs of tags in setBranchesToClone(). Make sure we also include fetch ref specs for the fetch command for tags. This mimics the behavior of native git's single-branch clone: git clone --branch <tag> --single-branch <URI> Bug: 542611 Change-Id: I285cf043751d9b0ba71258ee8214c0e5d1191428 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | | RenameBranchCommand: more consistent handling of short ref namesThomas Wolf2019-01-231-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several problems: * The command didn't specify whether it expected short or full names. * For the new name, it expected a short name, but then got confused if tags or both local and remote branches with the same name existed. * For the old name, it accepted either a short or a full name, but again got confused if a short name was given and a tag with the same name existed. With such an interface, one cannot use Repository.findRef() to reliably find the branch to rename. Use exactRef() for the new name as by the time the Ref is needed its full name is known. For determining the old Ref from the name, do the resolution explicitly: first try exactRef (assuming the old name is a full name); if that doesn't find anything, try "refs/heads/<old>" and "refs/remotes/<old>" explicitly. Throw an exception if the name is ambiguous, or if exactRef returned something that is not a branch (refs/tags/... or also refs/notes/...). Document in the javadoc what kind of names are valid, and add tests. A user can still shoot himself in the foot if he chooses exceptionally stupid branch names. For instance, it is still possible to rename a branch to "refs/heads/foo" (full name "refs/heads/refs/heads/foo"), but it cannot be renamed further using the new short name if a branch with the full name "refs/heads/foo" exists. Similar edge cases exist for other dumb branch names, like a branch with the short name "refs/tags/foo". Renaming using the full name is always possible. Bug: 542446 Change-Id: I34ac91c80c0a00c79a384d16ce1e727c550d54e9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | | Allow to check for signing keyGunnar Wagenknecht2019-01-221-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new API is intended for UIs to check if signing will be possible or would fail Bug: 543579 Change-Id: I6ce1fd4210e46d49dcdf420c99d08c93e022136c Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
* | | | | | | Handle premature EOF in BundleFetchConnectionThomas Wolf2019-01-221-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BundleFetchConnection.readLine() must abort on EOF, otherwise it gets stuck in an endless loop. Bug: 543390 Change-Id: I4cb3428560277888af114b928950d620bb6564f9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | | TemporaryBufferTest: Open TemporaryBuffer in try-with-resourceDavid Pursehouse2019-01-211-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Except the cases where the warning was suppressed in bf757cd because they are explicitly testing functionality that is not possible in t-w-r. Change-Id: I6c66eb31a2314028e09a9213dc695cd163f907e9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | SubmoduleWalkTest: Open Repository in try-with-resourceDavid Pursehouse2019-01-211-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I9c4ee4e4c55f48db1f21e18b212657e4dd3de053 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | SideBandOutputStreamTest: Open SideBandOutputStream in try-with-resourceDavid Pursehouse2019-01-211-47/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I34041a556a5a83afcd0c1bab00e5d8088c30ea3f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | UnionInputStreamTest: Open UnionInputStream in try-with-resourceDavid Pursehouse2019-01-211-115/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests were written for Java 7 which did not have AutoCloseable and the try-with-resource concept. When the project was updated to build with Java 8, the warnings were suppressed. Remove the suppressions and convert to use try-with-resource. Change-Id: Ic805bd571c4a2e4376ce5e7c34ca7ac86cbf5104 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | LocalDiskRepositoryTestCase#createRepository: Default auto-close to falseDavid Pursehouse2019-01-201-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 8ed59c5 ("Make TestRepository AutoCloseable", Jan 11, 2019) the TestRepository class is auto-closeable, but instantiations of it were not converted to use try-with-resource. Converting to try-with-resource results, in several cases, in the repository being closed twice because LocalDiskRepositoryTestCase has logic to close created repositories in the tearDown method. This results in several tests emitting a warning to the console: close() called when useCnt is already zero Change the default behavior of the createRepository method to not use the auto-close logic in LocalDiskRepositoryTestCase, so that thy will instead be closed (only once) using the AutoCloseable implementation. Deprecate the method that has the autoClose parameter. Change-Id: I63d62c9913f9b61271667861dae144e551d358c1 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | PushConnectionTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I539b3acea8da914fc745e54b0bf104cf344c181c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | MergerTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I1c4bd2fd5f0ad7112bd3ebe1506de3cf51231b36 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | MergeCommandTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-26/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: If620f6a98c5e8436a3edb4ee365ec02f41d0ea6a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | PackWriterTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-36/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ia4202c860b851bef5db72ea6781b3e6a32484e08 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | ReceivePackAdvertiseRefsHookTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-232/+251
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I7ab1de3516ac542821275add908ee70c427d781b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | SubmoduleStatusTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-47/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Iebb6abd35fa5b084a4c044e416a448785a3c9291 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | UploadPackTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-185/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Id37a07b00584aa8a884fa11cd6f42a16b44e77f3 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | PackParserTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ie3521f40ac80bc58df95f9f5dc79d51b29380461 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | Stop using deprecated methods of RemoteSetUrlCommand/RemoteRemoveCommandDavid Pursehouse2019-01-202-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I5234474b359a32bdae501b181f0726be2af1ec6a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | DirCacheCheckoutTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Iaf18ce230d6bf9b8bcb1895dd1bd3e4eb267de10 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | CheckoutCommandTest: Add comment to document intentionally empty catch blockDavid Pursehouse2019-01-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I5156c3c2de67be015ef1d785fcf6084919765635 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | | Implement signing commits using BouncyCastleMedha Bhargav Prabhala2019-01-161-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also includes a change to generating the jgit CLI jar. Shading is no longer possible because it breaks the signature of BouncyCastle. Instead, the Spring Boot Loader Maven plug-in is now used to generate an executable jar. Bug: 382212 Change-Id: I35ee3d4b06d9d479475ab2e51b29bed49661bbdc Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org> Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org> Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Allow CommitCommand to sign commitsGunnar Wagenknecht2019-01-162-0/+300
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the concept of a GpgSigner which will sign commits. The GpgSigner will be of a specific implementation (eg., Bouncycastle or OpenPgP executable). The actual implementation is not part of this change. Bug: 382212 Change-Id: Iea5da1e885c039e06bc8d679d46b124cbe504c8e Also-by: Medha Bhargav Prabhala <mprabhala@salesforce.com> Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com> Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
* | | | | | | Merge branch 'stable-5.2'Jonathan Nieder2019-01-101-28/+15
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.2.2-SNAPSHOT builds JGit v5.2.1.201812262042-r Prepare 5.1.6-SNAPSHOT builds JGit v5.1.5.201812261915-r UploadPack: Filter refs used for deepen-not resolution UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: Ia56348e54d62630d7c50a4747df89516fc5afad9 Signed-off-by: Jonathan Nieder <jrn@google.com>
| * | | | | | Merge branch 'stable-5.1' into stable-5.2Jonathan Nieder2018-12-261-28/+15
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: UploadPack: Avoid calling AdvertiseRefsHook twice Prepare 5.1.5-SNAPSHOT builds JGit v5.1.4.201812251853-r UploadPack: Filter refs used for want-ref resolution UploadPack: Defer want-ref resolution to after parsing Call AdvertiseRefsHook for protocol v2 Prepare 4.11.7-SNAPSHOT builds JGit v4.11.6.201812241910-r Prepare 4.9.9-SNAPSHOT builds JGit v4.9.8.201812241815-r UploadPack: Test filtering by AdvertiseRefsHook in stateless transports Prepare 4.7.8-SNAPSHOT builds JGit v4.7.7.201812240805-r Fix feature versions imported by feature org.eclipse.jgit.pgm Prepare 4.5.6-SNAPSHOT builds JGit v4.5.5.201812240535-r Call AdvertiseRefsHook before validating wants Change-Id: I5879df9b723a0dbf6a1eff89a34bbb269f3b773d Signed-off-by: Jonathan Nieder <jrn@google.com>
| | * | | | | UploadPack: Defer want-ref resolution to after parsingJonathan Nieder2018-12-261-30/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ProtocolV2Parser explains: // TODO(ifrade): This validation should be done after the // protocol parsing. It is not a protocol problem asking for an // unexisting ref and we wouldn't need the ref database here. Do so. This way all ref database accesses are in one place, in the UploadPack class. No user-visible change intended --- this is just to make the code easier to manipulate. Change-Id: I68e87dff7b9a63ccc169bd0836e8e8baaf5d1048 Signed-off-by: Jonathan Nieder <jrn@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Fix warnings for usage of deprecated RefDatabase#getRefMatthias Sohn2019-01-082-43/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I22a244114ef973b3801cf3b639ff782f21c02f98 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Fix "jgit checkout -f" to overwrite dirty worktree filesChristian Halstrick2019-01-081-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CheckoutCommand had a setForce() method. But this didn't correspond to native git's 'git checkout -f' option. Deprecate the old setForce() method and move its implementation to a new method setForceRefUpdate() and use it to implement the -B option in the CLI class Checkout. Add a setForced() method and use it to fix the associated '-f' option of the CLI Checkout class to behave like native git's 'git checkout -f' which overwrites dirty worktree files during checkout. This is still not fully matching native git's behavior: updating additionally dirty index entries is not done yet. Bug: 530771 Change-Id: I776b78eb623b6ea0aca42f681788f2e4b1667f15 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Deprecate Repository#hasObjectJonathan Nieder2019-01-047-86/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Its implementation contains } catch (IOException e) { // Legacy API, assume error means "no" return false; } Better to use ObjectDatabase#has, which throws IOException to report errors. Change-Id: I7de02f7ceb8f57b2a8ebdb16d2aa4376775ff933 Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | | RefDatabase: Introduce findRef synonym for getRefJonathan Nieder2018-12-261-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using findRef instead of getRef makes it clearer that the caller wants to search for the ref in the search path, instead of looking for a ref that exactly matches the input. This change introduces the new findRef method and deprecates getRef. It updates Repository#findRef to use the new method, ensuring some test coverage. Other callers will be updated in followup changes. A nice side effect of introducing the new findRef method is that it is final and based on firstExactRef, so implementers can focus on implementing the latter efficiently and do not have to carefully write custom path search code respecting SEARCH_PATH. Change-Id: Id3bb944344a9743705fd1f20193ab679298fa51c Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | | RefDirectory: Do not use search path to find additional refsJonathan Nieder2018-12-261-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Psuedorefs like FETCH_HEAD and MERGE_HEAD are supposed to be directly under the .git directory, not in other locations in the SEARCH_PATH like refs/ and refs/heads/. Use exactRef to access them. Change-Id: Iab8ac47008822fa78fc0691e239e518c34d7a98e Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | | RefDatabase: Remove fallback exactRef implementationJonathan Nieder2018-12-261-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is simpler to implement than getRef. Make it abstract so implementers remember to override it. Change-Id: I5f319be1fb1206d7a0142ea939dc4e1039f850ab Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | | Merge changes from topic 'update-index-ref-decorator'Jonathan Nieder2018-12-266-13/+173
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * changes: RefCursor: Remove unnecessary getUpdateIndex method RefDatabase/Ref: Add versioning to reference database
| * | | | | | | RefCursor: Remove unnecessary getUpdateIndex methodIvan Frade2018-12-263-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the reference carries its updateIndex, so the cursor doesn't need to expose it. Change-Id: Icbfca46f92a13f3d8215ad10b2a166a6f40b0b0f Signed-off-by: Ivan Frade <ifrade@google.com>
| * | | | | | | RefDatabase/Ref: Add versioning to reference databaseIvan Frade2018-12-266-5/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In DFS implementations the reference table can fall out of sync, but it is not possible to check this situation in the current API. Add a property to the Refs indicating the order of its updates. This version is set only by RefDatabase implementations that support versioning (e.g reftable based). Caller is responsible to check if the reference db creates versioned refs before accessing getUpdateIndex(). E.g: Ref ref = refdb.exactRef(...); if (refdb.hasVersioning()) { ref.getUpdateIndex(); } Change-Id: I0d5ec8e8df47c730301b2e12851a6bf3dac9d120 Signed-off-by: Ivan Frade <ifrade@google.com>
* | | | | | | | Skip some tests when the runtime cannot handle Unicode file pathsMasaya Suzuki2018-12-232-7/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When executing a test with LANG environment variable set to non UTF-8 encoding, it seems that JRE cannot handle Unicode file paths. This happens when this test is executed in Bazel as it unsets LANG (https://docs.bazel.build/versions/master/test-encyclopedia.html#initial-conditions). Skip the test if the runtime cannot handle Unicode file paths. Change-Id: I16bd3cd959dbaf2335b9c5202873e2f12ed0ba21 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* | | | | | | | Change RacyGitTests to create a racy git situation in a stable wayMasaya Suzuki2018-12-231-29/+24
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By using File#setLastModified, we can create a racy git situation stably. Tested with --runs_per_test=100 Bug: 526111 Change-Id: I60b3632d353e19f335668325aa603640be423f58 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* / / / / / / Avoid double wordsMincong HUANG2018-12-213-3/+3
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I0fdf595cba93f5a5cdd0496cee07ac91db304532 Signed-off-by: Mincong Huang <mincong.h@gmail.com>
* | | | | | Set git environment variables for hooksThomas Wolf2018-11-301-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Set GIT_DIR and GIT_WORK_TREE when calling hooks. Bug: 541622 Change-Id: I6153d8a6a934ec37a3a5e7319c2d0e516f539ab7 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | Merge "Fix IndexDiffs for git links"Christian Halstrick2018-11-285-1/+116
|\ \ \ \ \ \
| * | | | | | Fix IndexDiffs for git linksThomas Wolf2018-11-265-1/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After cloning a repo with a submodule, non-recursively, JGit would encounter in its TreeWalk in IndexDiff: * first, a missing gitlink (in index & HEAD, not in working tree) * second, the untracked folder (not in index and head, in working tree) As a result, it would report the submodule as missing. Canonical git reports a clean workspace. The root cause of this is that the path of a gitlink "x" did not compare equal to the path of a tree "x" in JGit. Correct Paths.compare() to account for that. If two paths are otherwise equal, then let gitlinks match both trees and files. Matching trees solves the bug. Matching files is necessary to handle the case where the gitlink directory was replaced by a file; see the new test case IndexDiffSubmoduleTest.testSubmoduleReplacedByFile(). Comparisons of unequal paths are left untouched, so the sort order is unchanged. After the fix, another bug(?) in WorkingTreeIterator became apparent: with core.dirNoGitLinks = true, it was no longer possible to overwrite a gitlink in the index. This is now fixed in WorkingTreeIterator. Add new test cases for the bug itself and for some related cases (submodule directory deleted or replaced by a file) in IndexDiffSubmoduleTest. Add a test for missing files in IndexDiffTest, and adapt the PathsTest to test matching gitlinks. Bug: 467631 Change-Id: I0549d10d46b1858e5eec3cc15095aa9f1d5f5280 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | | | | Merge branch 'stable-5.1'David Pursehouse2018-11-271-16/+39
|\ \ \ \ \ \ \ | |/ / / / / / |/| / / / / / | |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: I64d9b0099fc0d8449ec08f0b5653572b5c2f840f Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | | | | Merge branch 'stable-5.0' into stable-5.1David Pursehouse2018-11-271-16/+39
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: I63e7a56bb617b5ce8774e1dc7f5efdde25e7cd97 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * | | | Merge branch 'stable-4.11' into stable-5.0David Pursehouse2018-11-271-16/+39
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Fix DescribeCommand with multiple match options Fix git-describe tie-breakers Change-Id: Ibb98f143ee0ce7635beb30ec404b4134a73788f6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | * | | Fix DescribeCommand with multiple match optionsMatthias Sohn2018-11-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when multiple match options are given in git describe the result must not depend on the order of the match options. JGit wrongly picked the first match using the match options in the order they were defined. Fix this by concatenating the streams of matching tags for all match options and then choosing the first match on the concatenated stream sorted in tie break order. See https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt Change-Id: Id01433d35fa16fb4c30526605bee041ac1d954b2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * | | Fix git-describe tie-breakersHåvard Wall2018-11-091-15/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct behaviour as git 1.7.1.1 is to resolve tie-breakers to choose the most recent tag. https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.1.1.txt: * "git describe" did not tie-break tags that point at the same commit correctly; newer ones are preferred by paying attention to the tagger date now. Bug: 538610 Change-Id: Ib0b2a301997bb7f75935baf7005473f4de952a64 Signed-off-by: Håvard Wall <haavardw@gmail.com>
* | | | | | Add a method to get all values of HTTP header defined as listMatthias Sohn2018-11-261-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC 2616 [1] header field names are case insensitive. Header fields defined as a comma separated list can have multiple header fields with the same field name. Add a method to HttpConnection which retrieves all values with a given header field name with the field name compared case insensitive. [1] https://tools.ietf.org/html/rfc2616#section-4.2" Change-Id: I7f601b21cda99e84f43f866c7c7cb4cb0e3cf5c3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | Undo treating blobs with NULs as a single lineThomas Wolf2018-11-263-5/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit a551b646: revert the changes in RawParseUtils.lineMap(). Forcing all blobs containing a NUL byte as a single line causes blame to produce useless results as soon as it hits any version containing a NUL byte. Doing binary detection at this level also has the problem that the user cannot control it. Not by setting the text attribute nor in any other way. This came up in bug 541036, where a Java source inadvertently contained NUL bytes in strings. Even fixing this by using escapes "\000" will not fix JGit's blame for this file because the past versions will still contain the NUL byte. Native git can blame that file from bug 541036 fine. Added new tests verifying that blaming a text file containing a NUL byte produces sensible results. Bug: 541036 Change-Id: I8991bec88e9827cc096868c6026ea1890b6d0d32 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>