aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stable-6.3'Matthias Sohn2022-09-127-684/+367
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.3: Prepare 6.3.1-SNAPSHOT builds JGit v6.3.0.202209071007-r JGit v6.3.0.2022009070944-r [merge] Fix merge conflicts with symlinks Update DEPENDENCIES for 6.3.0 Update tycho to 2.7.5 Revert "Adds FilteredRevCommit that can overwrites its parents in the DAG." Revert "Option to pass start RevCommit to be blamed on to the BlameGenerator." Prepare 6.3.0-SNAPSHOT builds JGit v6.3.0.202208161710-m3 Change-Id: Ia9430fb516dca795e25064a190704b70689af364
| * [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>
| * Revert "Adds FilteredRevCommit that can overwrites its parents in theMatthias Sohn2022-09-065-381/+45
| | | | | | | | | | | | | | | | | | | | | | | | DAG." This reverts commit 6297491e8adb85e43d60ffe75fb71f335e733449. This is done as a quick fix for the failure of egit tests caused by the introduction of FilteredRevCommit. Bug: 580690 Change-Id: Ia6b651dd11b0a4b02d5e52247eb4bf13adf94e27
| * Revert "Option to pass start RevCommit to be blamed on to theMatthias Sohn2022-09-061-303/+26
| | | | | | | | | | | | | | | | | | | | | | | | BlameGenerator." This reverts commit 5747bba48b22a11beba8ebe0caf13a53d4ca96f2. This is done as a quick fix for the failure of egit tests caused by the introduction of FilteredRevCommit. Bug: 580690 Change-Id: Ia0178bc2de4fc825a81207bbd7979bf3a386c955
* | DfsBundleWriter: Add test case about GC_REST pack.yunjieli2022-09-071-1/+28
|/ | | | | | | | Add a test case to make sure that the bundle writer writes objects in GC_REST packs as well. Signed-off-by: Yunjie Li <yunjieli@google.com> Change-Id: Iba4d88c573aa1cda4505afbe2b83581a09a343df
* BaseSuperprojectWriter: report invalid paths as manifest errorsIvan Frade2022-08-231-0/+24
| | | | | | | | | | An invalid path in the manifest (e.g. '.') is reported by DirCache in a runtime exception. In server context this becomes a 500 instead of a user error. Wrap the runtime invalid path exception into a checked ManifestErrorException that caller can handle. Change-Id: I61a2104922765506ae232334891057bb06141d97
* ApplyCommand: fix ApplyResult#updatedFilesHan-Wen Nienhuys2022-08-231-7/+7
| | | | | | | | On executing a copy, mark the destination as updated. On executing a rename, mark both source and destination as updated. Change-Id: Ied5b9b0e5a14eac59a06cdd0961e25e143f50ff0
* Option to pass start RevCommit to be blamed on to the BlameGenerator.Ronald Bhuleskar2022-08-171-26/+303
| | | | | | | | | This can allow passing a FilteredRevCommit which is the filtered list of commit graph making it easier for Blame to work on. This can significantly improve blame performance since blame can skip expensive RevWalk. Change-Id: Ie127cb710d004079e9f53a5802130afdb49a7de1
* Adds FilteredRevCommit that can overwrites its parents in the DAG.Ronald Bhuleskar2022-08-165-45/+381
| | | | Change-Id: I1ea63a3b56074099688fc45d6a22943a8ae3c2ae
* DirCacheCheckout: load WorkingTreeOptions only onceThomas Wolf2022-08-141-3/+7
| | | | | | | | | | | | | | | | Previous code loaded the WorkingTreeOptions afresh for every single file being checked out. This checked the git config (all three files, repo, user and system config) for having been modified every time. These checks can be costly, for instance on Windows, or if one of the three config files is not on a local disk, or on an otherwise slow storage. Improve this by loading the options and thus checking the git config only once before the checkout. Bug: 579715 Change-Id: I21cd5a808f9d90b5ca2d022f91f0eeb8ca26091c Signed-off-by: Thomas Wolf <twolf@apache.org>
* Fix adding symlinks to the index when core.symlinks=falseThomas Wolf2022-08-131-0/+41
| | | | | | | | | | With core.symlinks=false, symlinks are checked out as plain files. When such a file is re-added to the index, and the index already contains a symlink there, add the file as a symlink. Previous code changed the index entry to a regular file. Bug: 580412 Change-Id: I5497bedc3da89c8b10120b8077c56bc5b67cb791 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 "Revert "Option to pass start RevCommit to be blamed on to the ↵Terry Parker2022-08-031-303/+26
|\ | | | | | | BlameGenerator.""
| * Revert "Option to pass start RevCommit to be blamed on to the BlameGenerator."Ronald Bhuleskar2022-08-031-303/+26
| | | | | | | | | | | | | | | | | | | | This reverts commit 59e8bec6e7705a89b5d0b9c6ac004b323ffa16b0. Reason for revert: The change in https://git.eclipse.org/r/c/jgit/jgit/+/194354 broke the egit test [1]. Calling c.getShortMessage() causes an NPE. [1] https://ci.eclipse.org/egit/job/egit.gerrit/2711/ Change-Id: Iaf5feb35f4bb4c3487b04be15d1fe11376975523
* | Merge "Revert "Adds FilteredRevCommit that can overwrites its parents in the ↵Terry Parker2022-08-035-280/+18
|\ \ | | | | | | | | | DAG.""
| * | Revert "Adds FilteredRevCommit that can overwrites its parents in the DAG."Ronald Bhuleskar2022-08-035-280/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ceb51a5e0e9db166e572ea7cd362795b4662b0cd. Reason for revert: The change in https://git.eclipse.org/r/c/jgit/jgit/+/194354 broke the egit test [1]. Calling c.getShortMessage() causes an NPE. [1] https://ci.eclipse.org/egit/job/egit.gerrit/2711/ Change-Id: I411565b6eaa0bbb562cc1c8a355942ff09fd29bc
* | | CleanCommand: fix prefix matchingThomas Wolf2022-08-032-0/+40
| |/ |/| | | | | | | | | | | | | | | | | String.startsWith() is not a valid test for file path prefixes: directory "a" is _not_ a prefix of a file "ab", only of "a/b". Add a proper Paths.isEqualOrPrefix() method and use it in CleanCommand. Bug: 580478 Change-Id: I6863e6ba94a8ffba6561835cc57044a0945d2770 Signed-off-by: Thomas Wolf <twolf@apache.org>
* | Option to pass start RevCommit to be blamed on to the BlameGenerator.Ronald Bhuleskar2022-08-021-26/+303
|/ | | | | | | | | This can allow passing a FilteredRevCommit which is the filtered list of commit graph making it easier for Blame to work on. This can significantly improve blame performance since blame can skip expensive RevWalk. Change-Id: I5dab25301d6aef7df6a0bc25a4c553c730199272
* Adds FilteredRevCommit that can overwrites its parents in the DAG.Ronald Bhuleskar2022-08-025-18/+280
| | | | Change-Id: I2df9843dde0f589f5fea6cedaaff52e313eea6de
* Add the ability to override parents on RevCommit.Ronald Bhuleskar2022-08-023-50/+245
| | | | | | | | | | | | | | | | | | | This makes RevCommit extensible to allow having different structure of child-parent relationship. This change is a pre-requsite for having a FilteredRevCommit that overrides parents from the RevCommit. That then provides a cheaper way to walk over a subset of RevCommits instead of an expensive way that applies filters while walking over selected commits. Useful with Blame which works on a single file and that can be made performant, if we know all the commits needed by the Blame algorithm. So Blame algorithm can avoid walking over finding what commits to blame on. This change makes parents field on RevCommit private and exposes it thrrough overrideable methods such as getParents, getParent at index, getParentCount and setParents. All other files other than RevCommit are updating the usages of accessing RevCommits parents. Change-Id: I2d13b001c599cc4ebc92d1ab6e07b07acb3b7fe5
* Merge "NameConflictTreeWalk: respect git order on multi-tree iteration"Han-Wen NIenhuys2022-08-011-2/+68
|\
| * NameConflictTreeWalk: respect git order on multi-tree iterationDmitrii Filippov2022-07-291-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NameConflictTreeWalk class is used in 3-way merge for iterating over entries in 3 different commits. The class provides information about a current entry and a state of the entry in commits (e.g entry is file, entry is directory, entry is missing). In rare cases, the tree walker can mix information about entries with different name. The problem appears, because git uses unusual sorting order for files. Example (this is a simplified real-life example): Commit 1: * gradle.properties - file * gradle - directory (with nested files) * gradle/file - file in gradle directory Commit 2: * gradle.properties - file * no entry with the name gradle Commit 3: * gradle.properties - file * gradle - file Here the names are ordered like this: "gradle" file <"gradle.properties" file < "gradle/file" file. NameConflictTreeWalk iterator already have code for processing git sorting order, however in the example above the code doesn't work correctly. Before the fix, NameConflictTreeWalk returns: #next() "gradle - directory" | "gradle.properties" | "gradle - file" - which is wrong. The expected result is #next() "gradle - directory | MISSED_FILE | "gradle - file" #next() "gradle.properties"|"gradle.properties"|"gradle.properties" Ensure that the "matches" field of tree iterators (which contains the current path) is kept in sync in the case above. Change-Id: Ief5aa06d80b358f4080043c8694aa0fd7c60045b Signed-off-by: Dmitrii Filippov <dmfilippov@google.com>
* | Fetch: add support for shallowRobin Müller2022-07-313-5/+275
|/ | | | | | | | | | This adds support for shallow cloning. The CloneCommand and the FetchCommand now have the new methods setDepth, setShallowSince and addShallowExclude to tell the server that the client doesn't want to download the complete history. Bug: 475615 Change-Id: Ic80fb6efb5474543ae59be590ebe385bec21cc0d
* Fix the handling of .git/info/exclude and core.excludesFileThomas Wolf2022-07-151-0/+82
| | | | | | | | | | | | | | The RootIgnoreNode in a WorkingTreeIterator must _not_ add the rules from .git/info/exclude or from the file designated by git config core.excludesFile to the list of rules read from the root .gitignore. These really must be separate nodes in a hierarchy, otherwise the precedence rules from [1] are violated and the outcome is not the same as in C git. [1] https://git-scm.com/docs/gitignore Bug: 580381 Change-Id: I57802ba7bbbe4f183504c882b6c77a78cc3a9b99 Signed-off-by: Thomas Wolf <twolf@apache.org>
* Merge branch 'stable-6.2'Matthias Sohn2022-07-062-0/+64
|\ | | | | | | | | | | | | | | | | | | * stable-6.2: UploadPack: don't prematurely terminate timer in case of error Do not create reflog for remote tracking branches during clone UploadPack: do not check reachability of visible SHA1s Add missing package import javax.management to org.eclipse.jgit Change-Id: Ia2280b848cea7bdfa5bc48356484e040d159845d
| * Merge branch 'stable-6.1' into stable-6.2Matthias Sohn2022-07-062-0/+64
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.1: UploadPack: don't prematurely terminate timer in case of error Do not create reflog for remote tracking branches during clone UploadPack: do not check reachability of visible SHA1s Add missing package import javax.management to org.eclipse.jgit Change-Id: Ib3ff6a038e1b92a931a7f2624c19bbefd8cb95fd
| | * Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2022-07-062-0/+64
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: UploadPack: don't prematurely terminate timer in case of error Do not create reflog for remote tracking branches during clone UploadPack: do not check reachability of visible SHA1s Add missing package import javax.management to org.eclipse.jgit Change-Id: I08734ee2c8f3296d908da6a29d53ed87c4b48eb2
| | | * Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2022-07-062-0/+64
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.13: UploadPack: don't prematurely terminate timer in case of error Do not create reflog for remote tracking branches during clone UploadPack: do not check reachability of visible SHA1s Add missing package import javax.management to org.eclipse.jgit Change-Id: I6db0a4d74399fde892eeec62efd2946f97547a5d
| | | | * Do not create reflog for remote tracking branches during cloneLuca Milanesio2022-06-252-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using JGit on a non-bare repository, the CloneCommand it previously created local reflogs for all branches including remote tracking ones, causing the generation of a potentially large number of files on the local filesystem. The creation of the remote-tracking branches (refs/remotes/*) during clone is not an issue for the local filesystem because all of them are stored in a single packed-refs file. However, the creation of a large number of ref logs on a local filesystem IS an issue because it may not be tuned or initialised in term of inodes to contain a very large number of files. When a user (or a CI system) performs the CloneCommand against a potentially large repository (e.g., millions of branches), it is interested in working or validating a single branch or tag and is unlikely to work with all the remote-tracking branches. The eager creation of a reflogs for all the remote-tracking branches is not just a performance issue but may also compromise the ability to use JGit for cloning a large repository. The behaviour implemented in this change is also consistent with the optimisation done in the C code-base [1]. We differentiate between clone and fetch commands using --branch <initialBranch> option, that is only available in clone command, and is set as HEAD per default. [1] https://github.com/git/git/commit/58f233ce1ed67bbc31a429fde5c65d5050fdbd7d Bug: 579805 Change-Id: I58d0d36a8a4ce42e0f59b8bf063747c4b81bd859 Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
| | * | | Merge branch 'stable-6.0' into stable-6.1Matthias Sohn2022-05-271-0/+12
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-6.0: Remove stray files (probes or lock files) created by background threads Change-Id: Iab21b9776c2ebecd4cad5d015028cadd4b6541db
| | | * | Merge branch 'stable-5.13' into stable-6.0Matthias Sohn2022-05-271-0/+12
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.13: Remove stray files (probes or lock files) created by background threads Change-Id: I7af1355a77f14995118145162f6bb8a4f1755f2b
| | | | * Remove stray files (probes or lock files) created by background threadsJames Z.M. Gao2022-05-271-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NOTE: port back from master branch. On process exit, it was possible that the filesystem timestamp resolution measurement left behind .probe files or even a lock file for the jgit.config. Ensure the SAVE_RUNNER is shut down when the process exits (via System.exit() or otherwise). Move lf.lock() into the try-finally block when saving the config file. Delete .probe files on JVM shutdown -- they are created in daemon threads that may terminate abruptly, not executing the "finally" clause that normally removes these files. Bug: 579445 Change-Id: Iaee2301eb14e6201406398a90228ad10cfea6098
* | | | | JGit blame very slow for large merge commits that rename filesSimeon Andreev2022-07-013-70/+256
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjusted BlameGenerator to filter rename detection with the blame path. This reduces the running time of the blame computation significantly, for repositories with massive commits involving renames. The filtered rename detection is made (internally) available with: org.eclipse.jgit.internal.diff.FilteredRenameDetector Bug: 578900 Change-Id: I6580004e81102d685081b8180da1587a35073d36 Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
* | | | | Fix DefaultCharset bug pattern flagged by error proneDavid Ostrovsky2022-06-171-14/+15
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | See more details in: [1]. [1] https://errorprone.info/bugpattern/DefaultCharset Change-Id: I3de0be57a2d74490a5b4e66801e9767b38f13bf9
* | | | Teach JGit to handle external diff/merge tools defined in .gitattributesAndre Bossert2022-06-022-3/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds API that allows UI to find (and handle) diff/merge tools, specific for the given path. The assumption is that user can specify file type specific diff/merge tools via gitattributes. Bug: 552840 Change-Id: I1daa091e9afa542a9ebb5417853dff0452ed52dd Signed-off-by: Mykola Zakharchuk <zakharchuk.vn@gmail.com> Signed-off-by: Andrey Loskutov <loskutov@gmx.de> Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Adapt diff- and merge tool code for PGM and EGit usageAndre Bossert2022-06-023-80/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool * DiffTools and MergeTools * store FS, gitDir and workTree for usage without git repository (for EGit preferences) * add getUserDefinedToolNames() and getPredefinedToolNames() * replace getToolNames() with getAllToolNames() that combines the two lists and put default tool name (diff.tool or merge.tool) as first element (for EGit preferences) * FileElement: refactoring of getFile() and friends to have midName (LOCAL, REMOTE etc.) always added to the temp file name (also for EGit) * FileElement: added directory attribute that is used in getFile() to return path with workDir as parent * DiffTool and MergeTool * added errw.flush(), because sometimes stderr is not printed in case of die() * print e.getMessage() always to stderr * Moved toolname and prompt logic into managers * Exported internal packages required for egit.ui Bug: 356832 Change-Id: I71e7f4dc362169a7612ca4f6546a021bc4b2b5f4 Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
* | | | Add availability check of pre-defined toolsAndre Bossert2022-06-012-24/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-difftool see: https://git-scm.com/docs/git-mergetool * now all available tools are printed with "--tool-help" * if no diff.tool or merge.tool is defined the first available pre-defined tool is used TODO: - add mergetools to difftools --> extra change or merge to this - return the exit-code of the tool to jgit / java runtime Bug: 356832 Change-Id: I20fb04e71ced981f5625020f461bbac24e6cec70 Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add filtering with help of DirCacheCheckout.getContent()Andre Bossert2022-05-303-20/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool * refactoring of content (FileElement) handling * now the temporary files are already filled with filtered content in the calling classes (PGM), that can be used with EGit content too TODO: * keep the temporaries when no change detected and the user answers no to the question if the merge was successful Bug: 356832 Change-Id: I86a0a052d059957d4d152c1bb94c262902c377d2 Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add command line support for "git mergetool"Andre Bossert2022-05-251-26/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool see: https://git-scm.com/docs/git-config * add command line support for "git mergetool" * add option handling for "--tool-help", "--tool=<mytool>", "--[no-]prompt", "--[no-]gui" * handle prompt * add MergeTools * add pre-defined mergetools * print merge actions --> no execute, will be done later Bug: 356832 Change-Id: I6e505ffc3d03f75ecf4bba452a25d25dfcf5793f Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add config reader for user-defined mergetoolsAndre Bossert2022-05-251-0/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: https://git-scm.com/docs/git-mergetool see: https://git-scm.com/docs/git-config * add config reader for user-defined mergetools * merge.tool * merge.guitool * mergetool.prompt * mergetool.keepBackup * mergetool.keepTemporaries * mergetool.writeToTemp * mergetool.<tool>.path * mergetool.<tool>.cmd * mergetool.<tool>.trustExitCode Bug: 356832 Change-Id: Ic4f07376630713d8e06cbad284d9c72c9ecc0405 Signed-off-by: Andre Bossert <andre.bossert@siemens.com>
* | | | Add difftool compare feature (execute external tool)Andre Bossert2022-05-252-16/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | see: http://git-scm.com/docs/git-difftool * add CommandExecutor that handles tool execution with help of "jgit.FS" * it handles tool execution with temporary created "command file" --> for for all "command interpreters" and parameters with spaces etc. * using of external bash.exe at Windows (MinGW) if shell-script is used as difftool command. It can be enabled with parameter "jgit.usemsys2bash=auto" that checks if command contains ".sh" or enabled / disabled with "jgit.usemsys2bash=true|false" * added special handling for empty files (e.g. deleted, added etc.) that are named "/dev/null" * added creation and deletion of temporary files needed for compare * added own Exception class for reporting to pgm / command line / EGit * added prompt option handling before executing difftool * reworked trustExitCode option for specific difftool and override for all difftools from config and command line * tested with command line options "--[no]-trust-exit-code", "--tool=<toolname>", "--[no]-gui", --[no]-prompt * ContentSource * added close() methods to close / cleanup used resources (like ObjectReader TreeWalk etc.) * added isWorkingTreeSource() methods to check if file can be used from working tree instead of copy from "ObjectLoader / ObjectReader" to temporary file (fixes "difftool <commit> <commit>") Bug: 356832 Change-Id: I5462fb6dbe4ecfd9da7c74117fce4070bbfd4d7a Signed-off-by: Andre Bossert <andre.bossert@siemens.com> Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
* | | | Remove stray files (probes or lock files) created by background threadsJames Z.M. Gao2022-05-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On process exit, it was possible that the filesystem timestamp resolution measurement left behind .probe files or even a lock file for the jgit.config. Ensure the SAVE_RUNNER is shut down when the process exits (via System.exit() or otherwise). Move lf.lock() into the try-finally block when saving the config file. Delete .probe files on JVM shutdown -- they are created in daemon threads that may terminate abruptly, not executing the "finally" clause that normally removes these files. Bug: 579445 Change-Id: Ie27aca1fdaddfa487ebe072c3913d78355910df8
* | | | Fetch: Introduce negative refspecs.yunjieli2022-04-132-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement negative refspecs in JGit fetch, following C Git. Git supports negative refspecs in source only while this change supports them in both source and destination. If one branch is equal to any branch or matches any pattern in the negative refspecs collection, the branch will not be fetched even if it's in the toFetch collection. With this feature, users can express more complex patterns during fetch. Change-Id: Iaa1cd4de5c08c273e198b72e12e3dadae7be709f Sign-off-by: Yunjie Li<yunjieli@google.com>
* | | | Use git config core.commentCharThomas Wolf2022-03-262-0/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This concerns committing, creating merge conflict messages and creating and editing squash messages. In a squash message, once the comment character has been determined initially is always the first character. Note that if core.commentChar=auto and there is a sequence of squashes, it may be necessary to change the comment character when a new message is added. Bug: 579325 Change-Id: Idca19284a0240cd322e7512ea299a03658e1b2c1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | CommitConfig: add support for core.commentCharThomas Wolf2022-03-261-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide access to the core.commentChar git config, and provide a utility method to determine an unused comment character if the setting is "auto". Bug: 579325 Change-Id: I1ec7e4deffea6ac5929a8538a624d73bb59e4ecc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Merge changes I5df54a92,Iecc61d1cMatthias Sohn2022-03-221-0/+16
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | * changes: LsRemoteCommand: apply url.*.insteadOf Factor out URL replacement from RemoteConfig
| * | | | LsRemoteCommand: apply url.*.insteadOfThomas Wolf2022-03-151-0/+16
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If LsRemoteCommand is used without repository, the remote URI was not translated. If the git user config contains e.g. [url "ssh://git@github.com/"] insteadOf = https://github.com/ and LsRemoteCommand is called with an HTTPS GitHub repository URL, the command should actually rewrite this to an SSH URI and use the SSH transport. Actually this same problem may exist everywhere Transport is used with an URIish instead of with a remote name. However, doing this translation in Transport.open(URIish) and in Transport.open(Repository, URIish, String) if no remote name is given would change the behavior and might break assumptions made in existing clients. For instance, EGit's PushOperation assumes that the URI obtained from PushResult.getURI() was the same as was passed in to Transport.open(Repository, URIish). URIs obtained from a RemoteConfig have this translation applied transparently, and in Transport we cannot know for sure whether or not a URI has already been translated, if needed. So doing this in Transport might also lead to translating URIs twice. Therefore this commit does the translation in LsRemoteCommand, where we can be sure that it won't affect other use cases. If other cases besides LsRemoteCommand are found where such a URI translation is missing, it'll have to be done at higher levels, possibly even in client code directly. Bug: 544769 Change-Id: I5df54a925d30b55d98e21f37f2851fe79649b064 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | [sideband] Ensure last bit of progress channel is writtenThomas Wolf2022-03-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the last sideband progress message didn't end in \r or \n, there may still be a buffered message at the end of a fetch or push. Ensure that message gets written, too, even if it may be only partial. Bug: 575629 Change-Id: I38edccb5cffb89e00e468480b43c7d951fb63e8e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | | Add tests for SideBandInputStreamThomas Wolf2022-03-191-0/+212
|/ / / | | | | | | | | | | | | Bug: 575629 Change-Id: I4591a64a2c07c7841417ec7a5c7883134ffda1be Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | | [checkout] Use .gitattributes from the commit to be checked outThomas Wolf2022-03-071-1/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit used only one set of attributes constructed from the global and info attributes, plus the attributes from working tree, index, and HEAD. These attributes must be used to determine whether the working tree is dirty. But for actually checking out a file, one must use the attributes from global, info, and *the commit to be checked out*. Otherwise one may not pick up definitions that are only in the .gitattributes of the commit to be checked out or that are changed in that commit with respect to the attributes currently in HEAD, the index, or the working tree. Maintain in TreeWalk different Attributes per tree, and add operations to determine EOL handling and smudge filters per tree. Use the new methods in DirCacheCheckout and ResolveMerger. Note that merging in JGit actually used the attributes from the base, not those from ours, which looks dubious at least. It now uses those from ours, and for checking out the ones from theirs. The canBeContentMerged() determination was also done from the base attributes, and is newly done from the ours attributes. Possibly this should take into account all three attributes, and only if all three agree the item can be content merged, a content merge should be attempted? (What if the binary/text setting changes between base, ours, or theirs?) Also note that JGit attempts to perform content merges on non-binary LFS files; there it used the filter attribute from base, too, even for the ours and theirs versions. Newly it takes the filter attribute from the correct tree. I'm not convinced doing content merges on potentially huge files like LFS files is really a good idea. Add tests in FilterCommandsTest and LfsGitTest to verify the behavior. Open question: using index and working tree as fallback for the attributes of ours (assuming it is HEAD) is OK. But does it also make sense for base and theirs in merging? Bug: 578707 Change-Id: I0bf433e9e3eb28479b6272e17c0666e175e67d08 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>