aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge
Commit message (Collapse)AuthorAgeFilesLines
* SimpleMergeTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+4
| | | | Change-Id: Ic40473aecb23e22c755a9e041592886fb3c448f9
* GitLinkMergeTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+4
| | | | Change-Id: I9a3f558ff578266a34f45ebf3026c7a093dd6f3c
* CherryPickTest: replace deprecated PersonIdent constructorMatthias Sohn2024-12-291-1/+5
| | | | Change-Id: Id0e61babb768d29d6317cc216eeaa5054e5fc869
* Merge branch 'stable-7.0' into stable-7.1Matthias Sohn2024-11-051-0/+328
|\ | | | | | | | | | | | | | | * stable-7.0: ResolveMerger: Allow setting the TreeWalk AttributesNodeProvider Add Union merge strategy support Change-Id: I15674134f4c73ac2de514d4fac4a36fca7ed7b07
| * Add Union merge strategy supportNasser Grainawi2024-11-041-0/+328
| | | | | | | | | | | | | | | | | | Allow users to specify the `union` strategy in their .gitattributes file in order to keep lines from both versions of a conflict [1]. [1] https://git-scm.com/docs/gitattributes.html#Documentation/gitattributes.txt-union Change-Id: I74cecceb2db819a8551b95fb10dfe7c2b160b709
* | RevolveMerger: honor ignoreConflicts also for binary filesKamil Musin2024-10-081-0/+70
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently difference in binary files during merge will cause them to be added to unmergedPaths regardless of whether ignoreConflicts is true. This creates an issue during merging with strategy "RECURSIVE", as it makes it impossible to create a virtual commit if there is a difference in a binary file. Resulting in the CONFLICTS_DURING_MERGE_BASE_CALCULATION error being thrown. This is especially problematic, since JGit has a rather simplistic rules for considering file binary, which easily leads to false positives. What we should do instead is keep OURS. This will not lead to silently ignoring difference in the final result. It will allow creation of virtual merge-base commit, and then the difference would be presented again in the final merge results. In essense it only affects what's shown as BASE in 3-way merge. Additionally, this is correct because - It's consistent with treatment of other unmergeable entities, for example Gitlinks - It's consistent with behaviour of CGit: - https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-binary states on diffs in binary OURS is picked by default. - In code: https://git.kernel.org/pub/scm/git/git.git/tree/merge-ll.c#n81 - ignoreConflicts in CGit afterwards ignores all issues with content merging https://git.kernel.org/pub/scm/git/git.git/tree/merge-ort.c#n5201 We also adjust the behaviour when .gitattributes tell us to treat the file as binary for the purpose of the merge. We only change the behaviour when ignoreConlicts = true, as otherwise the current behaviour works as intended. Change-Id: I2b69f80a13d250aad3fe12dd438b2763f3022270
* [errorprone] Fix pattern see UnusedVariableMatthias Sohn2024-04-291-4/+6
| | | | | | See https://errorprone.info/bugpattern/UnusedVariable Change-Id: I75d7602af31ed7d3264d2beab2d159cfbf29e7cb
* ResolveMerger: Fix the issue with binary modify-modify conflictsSruteesh2024-04-251-0/+186
| | | | | | | | | | | 1) If the file was marked as binary by git attributes, we should add the path to conflicts if content differs in OURS and THEIRS 2) If the path is a file in OURS, THEIRS and BASE and if it is a binary in any one of them, no content merge should be attempted and the file content is kept as is in the work tree Bug: jgit-14 Change-Id: I9201bdc53a55f8f40adade4b6a36ee8ae25f4db8
* MergeAlgorithm: Fix diff3 conflict hunk computationAntonin Delpeuch2024-04-091-0/+13
| | | | | | | | | | | | | | | Closes https://github.com/eclipse-jgit/jgit/issues/38. The previous code computed the boundaries of the base part of conflict hunks using line numbers computed for the 'ours' and 'theirs' revisions, leading to incorrect boundaries. This only affects the presentation of merge conflicts in diff3 mode (which is probably not used a lot yet on Gerrit). Successful merges are unaffected. Change-Id: I173c79bf5797896dc854791d6d05cb3f035726f4 Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu>
* Merge: Add diff3 style merge conflict formatter.Haamed Gheibi2023-07-311-33/+111
| | | | | | | Add base section to the merge conflict hunks. Bug: 442284 Change-Id: I977b43e7dd8119d6b72d11f09c4e8ec241750383
* Fix crashes on rare combination of file namesDmitrii Filippov2022-11-031-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NameConflictTreeWalk class is used in merge for iterating over entries in commits. The class uses a separate iterator for each commit's tree. In rare cases it can incorrectly report the same entry twice. As a result, duplicated entries are added to the merge result and later jgit throws an exception when it tries to process merge result. The problem appears only when there is a directory-file conflict for the last item in trees. Example from the bug: Commit 1: * subtree - file * subtree-0 - file Commit 2: * subtree - directory * subtree-0 - file Here the names are ordered like this: "subtree" file <"subtree-0" file < "subtree" directory. The NameConflictTreeWalk handles similar cases correctly if there are other files after subtree... in commits - this is processed in the AbstractTreeIterator.min function. Existing code has a special optimization for the case, when all trees are pointed to the same entry name - it skips additional checks. However, this optimization incorrectly skips checks if one of trees reached the end. The fix processes a situation when some trees reached the end, while others are still point to an entry. bug: 535919 Change-Id: I62fde3dd89779fac282479c093400448b4ac5c86
* [merge] Fix merge conflicts with symlinksThomas Wolf2022-09-071-0/+296
| | | | | | | | | | | | | | | | | | | | | Previous code would do a content merge on symlinks, and write the merge result to the working tree as a file. C git doesn't do this; it leaves a symlink in the working tree unchanged, or in a delete-modify conflict it would check out "theirs". Moreover, previous code would write the merge result to the link target, not to the link. This would overwrite an existing link target, or fail if the link pointed to a directory. In link/file conflicts or file/link conflicts, C git always puts the file into the working tree. Change conflict handling accordingly. Add tests for all the conflict cases. Bug: 580347 Change-Id: I3cffcb4bcf8e336a85186031fff23f0c4b6ee19d Signed-off-by: Thomas Wolf <twolf@apache.org>
* ResolveMerger: add coverage for inCore file => directory transitionHan-Wen Nienhuys2022-08-081-0/+33
| | | | Change-Id: I6c3473932eb418a036f5943c78e619184559ef3a
* Merge conflict messages: prefix conflict lines with a hashThomas Wolf2022-01-311-8/+18
| | | | | | | | C git also does so. Note that currently the comment character is hard-coded as the hash '#' throughout JGit. Bug: 548529 Change-Id: I4a5597694082a9e5b07412b365cfaf41fa034cfa Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* [test] Fix closing of test repositoriesNail Samatov2022-01-301-0/+1
| | | | | | | | | | | | | | | | Fix tests failing on Windows because Repository instance is created but not closed on tear down. Fix repositories closed twice, except in tests that test this behavior explicitly. Name the temporary directories the tests run in after the test method; that makes it easier to figure out in which tests repositories are closed twice if it should occur again in the future. Bug: 550111 Change-Id: I9398b58f0f36d2c29236d2a9a8599117d9083980 Signed-off-by: Nail Samatov <sanail@yandex.ru> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Make the buffer size for text/binary detection configurableThomas Wolf2021-10-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | The various streams used in JGit for text/binary and CR-LF detection used different buffer sizes. Most used 8000, but one used 8KiB, and one used 8096 (SIC!) bytes. Considering only the first 8kB of a file/blob is not sufficient; it may give behavior incompatible with C git. C git considers the whole blob; since it uses memory-mapped files it can do so with acceptable performance. Doing this in JGit would most likely incur a noticeable performance penalty. But 8kB is a bit small; in the file in bug 576971 the limit was hit before the first CR-LF, which occurred on line 155 at offset 9759 in the file. Make RawText.FIRST_FEW_BYTES only a default and minimum setting, and set it to 8KiB. Make the actual buffer size configurable: provide static methods getBufferSize() and setBuffersize(), and use getBufferSize() throughout instead of the constant. This enables users of the JGit library to set their own possibly larger buffer size. Bug: 576971 Change-Id: I447762c9a5147a521f73d2864ba59ed89f555d54 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Allow file mode conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-04-061-0/+76
| | | | | | | | | Similar to https://git.eclipse.org/r/c/jgit/jgit/+/175166, ignore path that have conflicts on attributes, so that the virtual base could be used by RecursiveMerger. Change-Id: I99c95445a305558d55bbb9c9e97446caaf61c154 Signed-off-by: Marija Savtchouk <mariasavtchouk@google.com>
* Allow dir/file conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-02-091-0/+264
| | | | | | | | | | | | | | | | If RecursiveMerger finds multiple base commits, it tries to compute the virtual ancestor to use as a base for the three way merge. Currently, the content conflicts between ancestors are ignored (file staged with the conflict markers). If the path is a file in one ancestor and a dir in the other, it results in NoMergeBaseException (CONFLICTS_DURING_MERGE_BASE_CALCULATION). Allow these conflicts by ignoring this unmerged path in the virtual base. The merger will compute diff in the children instead and it can be further fixed manually if needed. Change-Id: Id59648ae1d6bdf300b26fff513c3204317b755ab Signed-off-by: Marija Savtchouk <mariasavtchouk@google.com>
* GitlinkMergeTest: fix boxing warningsMatthias Sohn2020-09-051-1/+1
| | | | Change-Id: I4bdf1ab3e7d7e9d96318e2b16b792aa98ebd2ecd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge changes from topic "fix_ui"Terry Parker2020-09-031-0/+368
|\ | | | | | | | | | | | | | | | | | | * changes: ResolveMerger: do not content-merge gitlinks on del/mod conflicts ResolveMerger: Adding test cases for GITLINK deletion ResolveMerger: choose OURS on gitlink when ignoreConflicts ResolveMerger: improving content merge readability ResolveMerger: extracting createGitLinksMergeResult method ResolveMerger: Adding test cases for GITLINK merge
| * ResolveMerger: do not content-merge gitlinks on del/mod conflictsDemetr Starshov2020-08-261-9/+0
| | | | | | | | | | | | | | | | | | | | Previously ResolveMerger tried to make a fulltext merge entry in case one of sides got deleted regardless of file mode. This is not applicable for GITLINK type of entry. After this change it is rendering appropriate merge result. Signed-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: Ibdb4557bf8781bdb48bcee6529e37dc80582ed7e
| * ResolveMerger: Adding test cases for GITLINK deletionDemetr Starshov2020-08-261-0/+91
| | | | | | | | | | | | | | Add test cases which cover content-merge resolve logic for deletion. Sign-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: I2f2b37e29adc973a5a0cfcc5c8bc32a2c38efdfa
| * ResolveMerger: choose OURS on gitlink when ignoreConflictsDemetr Starshov2020-08-261-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Option ignoreConflicts is used when a caller want to create a virtual commit and use it in a future merge (recursive merge) or show it on UI (e.g. Gerrit). According to contract in case of ignoreConflicts ResolveMerger should populate only stage 0 for entries with merge conflicts as if there is no conflict. Current implementation breaks this contract for cases when gitlink revision is ambiguous. Therefore, always select 'ours' when we merge in ignoreConflicts mode. This will satisfy the contract contract, so recursive merge can succeed, however it is an arbitrary decision, so it is not guaranteed to select best GITLINK in all cases. GITLINK merging is a special case of recursive merge because of limitations of GITLINK type of entry. It can't contain more than 1 sha-1 so jgit can't write merge conflicts in place like it can with a blob. Ideally we could signal the conflict with a special value (like '0000...'), but that must be supported by all tooling (git fsck, c-git)." Signed-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: Id4e9bebc8e828f7a1ef9f83259159137df477d89
| * ResolveMerger: Adding test cases for GITLINK mergeDemetr Starshov2020-08-261-0/+291
| | | | | | | | | | | | | | | | | | | | | | | | Add test cases which cover content-merge resolve logic. Git clients try to agressively merge blobs by content, but GITLINK types of entries can't be merged with each other or with blobs. This change ensures all possible permutations which can trigger blob and GITLINK content merge are covered. Signed-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: I7e83a28a14d4d2f9e0ba2b1cffbf3224fb7f3fef
* | Keep line endings for text files committed with CR/LF on text=autoThomas Wolf2020-08-171-1/+43
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Git never converts line endings if the version in the repository is a text file with CR/LF and text=auto. See [1]: "When the file has been committed with CRLF, no conversion is done." Because the sentence just before is about converting line endings on check-in, I had understood that in commit 60cf85a [2] to mean that no conversion on check-in was to be done. However, as bug 565048 and a code inspection of the C git code showed it really means no conversion is done on check-in *or check-out*. If the text attribute is not set but core.autocrlf = true, this is the same as text=auto eol=crlf. C git does not convert on check-out even on text=auto eol=lf if the index version is a text file with CR/LF. For check-in, one has to look at the intended target, which is done in WorkingTreeIterator since commit 60cf85a. For check-out, it can be done by looking at the source and can thus be done in the AutoLFOutputStream. Additionally, provide a constructor for AutoLFInputStream to do the same; for cases where the equivalent of a check-out is done via an input stream obtained from a blob. (EGit does that in its GitBlobStorage for the Eclipse compare framework; it's more efficient than using a TemporaryBuffer and DirCacheCheckout.getContent(), and it avoids the need for a temporary file.) Adapt existing tests, and add new checkout and merge tests to verify the resulting files have the correct line endings. EGit's GitBlobStorage will need to call the new version of EolStreamTypeUtil.wrapInputStream(). [1] https://git-scm.com/docs/gitattributes#Documentation/gitattributes.txt-Settostringvalueauto [2] https://git.eclipse.org/r/c/jgit/jgit/+/127324 Bug: 565048 Change-Id: If1282ef43e2abd00263541bd10a01fe1f5c619fc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* SimpleMergeTest: Clean up code styleDemetr Starshov2020-06-101-156/+149
| | | | | Signed-off-by: Demetr Starshov <dstarshov@google.com> Change-Id: Ib0149279324a8b085eec4c60d02c8f32a8cc86bb
* ResolveMerger: Ignore merge conflicts if asked soIvan Frade2020-03-191-0/+88
| | | | | | | | | | | | | | | | | | | | The recursive merge strategy builds a virtual ancestor merging recursively the common bases (when more than one) between the want-to-merge commits. While building this virtual ancestor, content conflicts are ignored, but current code doesn't do so when a file is removed. This was spotted in [1], for example. Merging two commits to build the virtual ancestor bumped into a conflict (modified in one side, deleted in the other) that stopped the process. Follow the "spec" and in case of conflict leave the unmerged content in the index and working trees. [1] https://android-review.googlesource.com/c/kernel/common/+/1228962 Change-Id: Ife9c32ae3ac3a87d3660fa1242e07854b65169d5 Signed-off-by: Ivan Frade <ifrade@google.com>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-047-266/+35
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Close ObjectReaders in testsThomas Wolf2019-10-211-3/+3
| | | | Change-Id: Ic839af4f85861fb48091d45679e2a614f001d770 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Close some Repository instances in testsThomas Wolf2019-10-211-2/+2
| | | | | | | 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 TreeWalks in testsThomas Wolf2019-10-152-46/+50
| | | | | | | 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>
* Fix NarrowingCompoundAssignment warnings from Error ProneDavid Pursehouse2019-08-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Error Prone reports: [NarrowingCompoundAssignment] Compound assignments from long to int hide lossy casts and [NarrowingCompoundAssignment] Compound assignments from int to byte hide lossy casts See https://errorprone.info/bugpattern/NarrowingCompoundAssignment Fix the warnings by adding explicit casts or changing types as necessary. Now that all occurrences of the warning are fixed, increase its severity to ERROR. Change-Id: Idb3670e6047b146ae37daee07212ff9455512623 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2019-08-081-21/+26
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Fix OpenSshConfigTest#config FileSnapshot: fix bug with timestamp thresholding In LockFile#waitForStatChange wait in units of file time resolution Cache FileStoreAttributeCache per directory Fix FileSnapshot#save(long) and FileSnapshot#save(Instant) Persist minimal racy threshold and allow manual configuration Measure minimum racy interval to auto-configure FileSnapshot Reuse FileUtils to recursively delete files created by tests Fix FileAttributeCache.toString() Add test for racy git detection in FileSnapshot Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit Add missing javadoc in org.eclipse.jgit.junit Enhance RepeatRule to report number of failures at the end Fix FileSnapshotTests for filesystem with high timestamp resolution Retry deleting test files in FileBasedConfigTest Measure filesystem timestamp resolution already in test setup Refactor FileSnapshotTest to use NIO APIs Measure stored timestamp resolution instead of time to touch file Handle CancellationException in FileStoreAttributeCache Fix FileSnapshot#saveNoConfig Use Instant for smudge time in DirCache and DirCacheEntry Use Instant instead of milliseconds for filesystem timestamp handling Workaround SecurityException in FS#getFsTimestampResolution Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution FS: ignore AccessDeniedException when measuring timestamp resolution Add debug trace for FileSnapshot Use FileChannel.open to touch file and set mtime to now Persist filesystem timestamp resolution and allow manual configuration Increase bazel timeout for long running tests Bazel: Fix lint warning flagged by buildifier Update bazlets to latest version Bazel: Add missing dependencies for ArchiveCommandTest Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file Add support for nanoseconds and microseconds for Config#getTimeUnit Optionally measure filesystem timestamp resolution asynchronously Delete unused FileTreeIteratorWithTimeControl FileSnapshot#equals: consider UNKNOWN_SIZE Timeout measuring file timestamp resolution after 2 seconds Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8 Fix non-deterministic hash of archives created by ArchiveCommand Update Maven plugins ecj, plexus, error-prone Update Maven plugins and cleanup Maven warnings Make inner classes static where possible Fix API problem filters Change-Id: I238adfd3080a5fed9d64c3c757297da6ea893918 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-08-081-21/+26
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Fix OpenSshConfigTest#config FileSnapshot: fix bug with timestamp thresholding In LockFile#waitForStatChange wait in units of file time resolution Cache FileStoreAttributeCache per directory Fix FileSnapshot#save(long) and FileSnapshot#save(Instant) Persist minimal racy threshold and allow manual configuration Measure minimum racy interval to auto-configure FileSnapshot Reuse FileUtils to recursively delete files created by tests Fix FileAttributeCache.toString() Add test for racy git detection in FileSnapshot Repeat RefDirectoryTest.testGetRef_DiscoversModifiedLoose 100 times Fix org.eclipse.jdt.core.prefs of org.eclipse.jgit.junit Add missing javadoc in org.eclipse.jgit.junit Enhance RepeatRule to report number of failures at the end Fix FileSnapshotTests for filesystem with high timestamp resolution Retry deleting test files in FileBasedConfigTest Measure filesystem timestamp resolution already in test setup Refactor FileSnapshotTest to use NIO APIs Measure stored timestamp resolution instead of time to touch file Handle CancellationException in FileStoreAttributeCache Fix FileSnapshot#saveNoConfig Use Instant for smudge time in DirCache and DirCacheEntry Use Instant instead of milliseconds for filesystem timestamp handling Workaround SecurityException in FS#getFsTimestampResolution Fix NPE in FS$FileStoreAttributeCache.getFsTimestampResolution FS: ignore AccessDeniedException when measuring timestamp resolution Add debug trace for FileSnapshot Use FileChannel.open to touch file and set mtime to now Persist filesystem timestamp resolution and allow manual configuration Increase bazel timeout for long running tests Bazel: Fix lint warning flagged by buildifier Update bazlets to latest version Bazel: Add missing dependencies for ArchiveCommandTest Bazel: Remove FileTreeIteratorWithTimeControl from BUILD file Add support for nanoseconds and microseconds for Config#getTimeUnit Optionally measure filesystem timestamp resolution asynchronously Delete unused FileTreeIteratorWithTimeControl FileSnapshot#equals: consider UNKNOWN_SIZE Timeout measuring file timestamp resolution after 2 seconds Fix RacyGitTests#testRacyGitDetection Change RacyGitTests to create a racy git situation in a stable way Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8 Fix non-deterministic hash of archives created by ArchiveCommand Update Maven plugins ecj, plexus, error-prone Update Maven plugins and cleanup Maven warnings Make inner classes static where possible Fix API problem filters Change-Id: Ia57385b2a60f48a5317c8d723721c235d7043a84 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Use Instant instead of milliseconds for filesystem timestamp handlingMatthias Sohn2019-07-181-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables higher file timestamp resolution on filesystems like ext4, Mac APFS (1ns) or NTFS (100ns) providing high timestamp resolution on filesystem level. Note: - on some OSes Java 8,9 truncate milliseconds, see https://bugs.openjdk.java.net/browse/JDK-8177809, fixed in Java 10 - UnixFileAttributes truncates timestamp resolution to microseconds when converting the internal representation to FileTime exposed in the API, see https://bugs.openjdk.java.net/browse/JDK-8181493 - WindowsFileAttributes also provides only microsecond resolution Change-Id: I25ffff31a3c6f725fc345d4ddc2f26da3b88f6f2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8David Pursehouse2019-06-191-1/+2
| | | | | | | | | | | | | | | Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * Make inner classes static where possibleDavid Pursehouse2019-06-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by Error Prone: An inner class should be static unless it references members of its enclosing class. An inner class that is made non-static unnecessarily uses more memory and does not make the intent of the class clear. See https://errorprone.info/bugpattern/ClassCanBeStatic Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> (cherry picked from commit ee40efcea44bc0c9a28afe29a80c87636947484e)
* | | MergerTest: Open TestRepository in try-with-resourceDavid Pursehouse2019-01-201-8/+9
| | | | | | | | | | | | | | | Change-Id: I1c4bd2fd5f0ad7112bd3ebe1506de3cf51231b36 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Avoid double wordsMincong HUANG2018-12-211-1/+1
|/ / | | | | | | | | Change-Id: I0fdf595cba93f5a5cdd0496cee07ac91db304532 Signed-off-by: Mincong Huang <mincong.h@gmail.com>
* | MergeFormatter{Pass}: Use Charset instead of StringDavid Pursehouse2018-09-302-2/+2
| | | | | | | | | | | | | | | | Deprecate constructors and methods taking a character set name as a String, in favor of new variants taking a Charset. Change-Id: I616c601daf232fa17610dba1087fd902030d46ea Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Deprecate Constants.CHARACTER_ENCODING in favor of StandardCharsets.UTF_8David Pursehouse2018-09-301-1/+2
| | | | | | | | | | Change-Id: I621ba174235a6fb56236e54d24bce704bb5afb28 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Make inner classes static where possibleDavid Pursehouse2018-09-261-2/+2
|/ | | | | | | | | | | | | As reported by Error Prone: An inner class should be static unless it references members of its enclosing class. An inner class that is made non-static unnecessarily uses more memory and does not make the intent of the class clear. See https://errorprone.info/bugpattern/ClassCanBeStatic Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8David Pursehouse2018-09-042-9/+10
| | | | | Change-Id: I3b748620f067582afef20f144feebe40d0332be2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Specify charset when constructing InputStreamReaderDavid Pursehouse2018-09-021-1/+3
| | | | | | | | | | | | ErrorProne warns [1] about implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: I0fd489d352170339c3867355cd24324dfdbd4b59 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix ResolveMerger: rebase with autocrlf=true, direct checkoutThomas Wolf2018-08-131-0/+39
| | | | | | | | | | | ResolveMerger.checkout() and cleanUp() check out files directly and must honor CR/LF settings and also smudge filters. Deprecate the 3-argument version of DirCacheCheckout.checkoutEntry(). It isn't used anymore anywhere in JGit (nor in EGit). Bug: 537410 Change-Id: I062b35401c8bd5bc99deb2f68f91089a0643504c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-153-3/+3
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Rename RecursiveMergerTest and ResolveMergerTest to reduce confusionDavid Pursehouse2018-03-242-2/+2
| | | | | | | | | | | | | | | | The class names imply that RecursiveMergerTest tests the RecursiveMerger and ResolveMergerTest tests the ResolveMerger. In fact, both of them include coverage of both strategies; the difference is that RecursiveMergerTest is only testing criss-cross merges. The tests cannot be combined into a single class because the criss-cross test methods have additional data points. Instead, rename the classes to more meaningful names. Change-Id: I7ca8a03a3b7e351e2d4fcaca3b3186c098a3ca66 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* ResolveMergerTest: Use @DataPoints instead of @DataPointDavid Pursehouse2018-03-241-6/+4
| | | | | | | | | | | Define strategiesUnderTest as an array of MergeStrategy using the @DataPoints annotation, rather than two separate variables each annotated as @DataPoint. This makes the implementation consistent with RecursiveMergerTest. Change-Id: I9f1d525b38cb59634ba054c7779dc4af1fc46e25 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Open auto-closeable resources in try-with-resourceDavid Pursehouse2018-03-131-12/+14
| | | | | | | | | | | | | | | | | | | | When an auto-closeable resources is not opened in try-with-resource, the warning "should be managed by try-with-resource" is emitted by Eclipse. Fix the ones that can be silenced simply by moving the declaration of the variable into a try-with-resource. In cases where we explicitly call the close() method, for example in tests where we are testing specific behavior caused by the close(), suppress the warning. Leave the ones that will require more significant refcactoring to fix. They can be done in separate commits that can be reviewed and tested in isolation. Change-Id: I9682cd20fb15167d3c7f9027cecdc82bc50b83c4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8David Pursehouse2018-03-111-7/+7
| | | | | Change-Id: I6714fc3666e1bced22abba94ceb700477349586e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>