aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java
Commit message (Collapse)AuthorAgeFilesLines
* AddCommand: implement --all/--no-allThomas Wolf2025-02-261-2/+14
| | | | | | | | | | | | | | | | | | | Command-line git stages deletions if file paths are given. (i.e., --all is implied.) File paths are also optional if --update or --all (or --no-all) are given. Add a setter and getter for an "all" flag on AddCommand. Check consistency with the "update" flag in call(). Make file paths optional (imply a "." path) if update is set or if setAll() had been called. If file paths are given, set the all flag. Stage deletions if update is set, or if the "all" flag is set. Add the C git command-line options for the "all" flag to jgit.pgm.Add. Bug: jgit-122 Change-Id: Iedddedcaa2d7a2e75162454ea047f34ec1cf3660
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
| | | | | | | | | | 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 some Repository instances in testsThomas Wolf2019-10-211-3/+5
| | | | | | | This doesn't yet ensure that _all_ repositories are closed. It only handles the obvious, local, and easy cases. Change-Id: I0f9f8607791f0f03ed1f5ad71e9595e78b78892f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Close ObjectInserters in testsThomas Wolf2019-10-211-2/+4
| | | | Change-Id: I0048a9ae23aee79cfecafb15855c63cd92818c57 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix IndexDiffs for git linksThomas Wolf2018-11-261-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Skip ignored directories in FileTreeIteratorThomas Wolf2018-05-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Make FileTreeIterator not enter ignored directories by default. We only need to enter ignored directories if we do some operation against git, and there is at least one tracked file underneath an ignored directory. Walking ignored directories should be avoided as much as possible as it is a potential performance bottleneck. Some projects have a lot of files or very deep hierarchies in ignored directories; walking those may be costly (especially so on Windows). See for instance also bug 500106. Provide a FileTreeIterator.setWalkIgnoredDirectories() operation to force the iterator to iterate also through otherwise ignored directories. Useful for tests (IgnoreNodeTest, CGitIgnoreTest), or to implement things like "git ls-files --ignored". Add tests in DirCacheCheckoutTest, and amend IndexDiffTest to test a little bit more. Bug: 388582 Change-Id: I6ff584a42c55a07120a4369fd308409431bdb94a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-8/+8
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* IndexDiffTest: Open Git instances in try-with-resourcesDavid Pursehouse2016-02-151-334/+340
| | | | | Change-Id: I7fa2d16561982ddfde053f2fe78135c114b66b1d Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Remove unnecessary suppression of deprecation warnings in testsDavid Pursehouse2016-01-251-1/+0
| | | | | Change-Id: I722f8c2e80129e0129349b55a53b29626e2af21c Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry andAndrey Loskutov2016-01-191-46/+45
| | | | | | | | | friends"" This reverts commit 2cc80187d3633adedc99eb97132e0a749b457c19. Bug: 486105 Change-Id: Id4f9987c33d66cbed9de6e4d4d6784afdd01a3cf Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends"Shawn Pearce2016-01-151-45/+46
| | | | | | | | This reverts commit 0f8743d4d7a4f3af1eccea60d45d51d13f1a2ad4. JGit is unable to iterate its API. Change-Id: Ie3d6a28e622a5c0cf54768a2299f1c44c0114c19
* Remove deprecated Tree, TreeEntry, FileTreeEntry and friendsShawn Pearce2016-01-091-46/+45
| | | | | | | These types were deprecated in 0.9.1 (aka 384a19eee07a2f). If anyone is still using them, its time to stop. Change-Id: I3f73347ba78c639e0c6a504812bc1a0702f829b1
* Replace deprecated release() methods by close()Matthias Sohn2015-05-211-4/+1
| | | | | | | | See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add IndexDiff tests for merge conflict state BOTH_ADDEDLaurent Goubet2014-08-021-0/+116
| | | | | | | | | JGit handled this case improperly which these tests demonstrate. Fixed by I25915880f304090fe90584c79bddf021231227a2. Bug: 440537 Change-Id: Ia29c1d6cf8c0ce724cc3ff5ed9e0b396949b44bf Signed-off-by: Laurent Goubet <laurent.goubet@obeo.fr> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix for core.autocrlf=input resulting in modified fileRobin Rosenberg2014-02-021-0/+31
| | | | | | | | | | | This version does not attempt to unsmudge, unlike the first attempt in Idafad150553df14827eccfde2e3b95760e16a8b6. Bug: 372834 Change-Id: I9300e735cb16d6208e1df963abb1ff69f688155d Also-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
* Do not report ignored directories as untrackedMatthias Sohn2014-01-191-0/+47
| | | | | Change-Id: I7e3f6b9fb1ac4b99d2cc9a78c63aad86f4fa5744 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* IndexDiff: Provide stage state for conflicting entriesRobin Stocker2013-04-191-0/+48
| | | | | | | | | | | | | Adds a new method getConflictingStageStates() which returns a Map<String, StageState> (path to stage state). StageState is an enum for all possible stage combinations (BOTH_DELETED, ADDED_BY_US, ...). This can be used to implement the conflict text for unmerged paths in output of "git status" or in EGit for decorations/hints. Bug: 403697 Change-Id: Ib461640a43111b7df4a0debe92ff69b82171329c Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Move base test classes to the junit bundle for reuse for Java 7 testsRobin Rosenberg2013-02-041-0/+1
| | | | Change-Id: Iedb54eb9d8396bc3ae66d8754c1527fd9ca655f9
* Ignore removed files with an assume-valid index entryRobin Rosenberg2013-01-031-4/+9
| | | | | | Bug: 347067 Change-Id: I5472e69dc77e26b5f248a4a04295775cf5051215 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Hide deprecation warnings in some test classesRobin Rosenberg2012-12-271-0/+1
| | | | | | | | These test classes heavily rely on Tree and associated classes. They are convenient for building test cases and hence not yet replaced, but there is a deprecation warning at about every line, which is not helpful. Change-Id: Ia7cc8f3bb980dc03055b94748b6c7529a82ea5a5
* Git API does not declare GitAPIException call() and related cleanupsRobin Rosenberg2012-05-301-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | All commands should throw a GitAPIException so new exceptions can be added without breaking the builds of old code, i.e. anyone that calls a Git API should catch GitAPIException and not just the currently known exceptions. Now the only checked exceptions on Git API calls are GitException and subclasses of it. New checked exceptions that are subclasses of GitException may be added without breaking the API. Javadoc for GitAPIException is declared on GitCommand and inherited to subclasses. JGitInternalException is not explicitly documented anymore. Unfortunately this change itself breaks the API. The intention is that it shall be possible to add new checked subclasses of GitAPIException without breaking the API. Bug: 366914 EGit-Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5 Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add detection of untracked folders to IndexDiffFilterJens Baumgart2011-11-101-0/+66
| | | | | | | | | | | | | | | Decorators need to know whether folders in the working tree contain only untracked files. This change enhances IndexDiffFilter to report such folders. This works only together with treewalks which operate in default traversal mode. For treewalks which process entries in postorder mode (files are walked before their parent folder is walked) this detection doesn't work. Bug: 359264 Change-Id: I9298d1e3ccac0aec8bbd4e8ac867bc06a5c89c9f Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Deprecate GitIndex more by using only DirCache internally.Robin Rosenberg2011-11-091-30/+58
| | | | | | | | | | | | | | | | This includes merging ReadTreeTest into DirCacheCheckoutTest and converting IndexDiffTest to use DirCache only. The GitIndex specific T0007GitIndex test remains. GitIndex is deprecated. Let us speed up its demise by focusing the DirCacheCheckout tests to using DirCache instead. This also add explicit deprecation comments to methods that depend on GitIndex in Repository and TreeEntry. The latter is deprecated in itself. Change-Id: Id89262f7fbfee07871f444378f196ded444f2783 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* IndexDiff: conflicting files aren't properly shownBernard Leach2011-05-051-4/+79
| | | | | | | | | | Before this change any files in the conflicting set would also be listed in the the other IndexDiff Sets which is confusing. With this change a conflicting file will not be included in any of the other sets. Change-Id: Ife9f2652685220bcfddc1f9820423acdcd5acfdc Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Added support to IndexDiff to return information on conflictsBernard Leach2011-04-191-0/+46
| | | | | Change-Id: I43c13eb72a44f80135c93525fce0c0280b0e64a2 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Convert all JGit unit tests to JUnit 4Robin Rosenberg2010-12-311-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Eclipse has some problem re-running single JUnit tests if the tests are in Junit 3 format, but the JUnit 4 launcher is used. This was quite unnecessary and the move was not completed. We still have no JUnit4 test. This completes the extermination of JUnit3. Most of the work was global searce/replace using regular expression, followed by numerous invocarions of quick-fix and organize imports and verification that we had the same number of tests before and after. - Annotations were introduced. - All references to JUnit3 classes removed - Half-good replacement for getting the test name. This was needed to make the TestRngs work. The initialization of TestRngs was also made lazily since we can not longer find out the test name in runtime in the @Before methods. - Renamed test classes to end with Test, with the exception of TestTranslateBundle, which fails from Maven - Moved JGitTestUtil to the junit support bundle Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* IndexDiff: Use isModified() when comparing index-worktreeShawn O. Pearce2010-12-081-3/+4
| | | | | | | | | | | | The isModified() is more efficient because it can skip over files that are stat clean, without needing to scan them. This is useful to efficently work on paths that were already staged and thus differ between HEAD and the index, but not between the index and the working tree. Change-Id: I4418202e612f0571974e0898050d987c6c280966 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Include list of assume unchanged files in IndexDiffStefan Lay2010-11-301-0/+45
| | | | | | | | | | The IndexDiff had not collected the info if the flag "assume-unchanged" is set. This information is useful for clients which may want to decide if specific actions are allowed on a file. Bug: 326213 Change-Id: I14bb7b03247d6c0b429a9d8d3f6b10f21d8ddeb1 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* IndexDiff: support state [removed, untracked]Jens Baumgart2010-11-081-0/+31
| | | | | | | | | | IndexDiff was extended to detect files which are both removed from the index and untracked. Before this change these files were only added to the removed collection. Change-Id: I971d8261d2e8932039fce462b59c12e143f79f90 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Delete deprecated ObjectWriterShawn O. Pearce2010-08-231-9/+20
| | | | | | | | ObjectWriter is a deprecated API that people shouldn't be using. So get rid of it in favor of the ObjectInserter API. Change-Id: I6218bcb26b6b9ffb64e3e470dba5dca2e0a62fd4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Add gitignore support to IndexDiff and use TreeWalkJens Baumgart2010-08-041-6/+17
| | | | | | | | | | IndexDiff was re-implemented and now uses TreeWalk instead of GitIndex. Additionally, gitignore support and retrieval of untracked files was added. Change-Id: Ie6a8e04833c61d44c668c906b161202b200bb509 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Remove trailing whitespace at end of lineAlex Blewitt2009-10-311-3/+3
| | | | | | | | | As discussed on the egit-dev mailing list, we prefer not to have trailing whitespace in our source code. Correct all currently offending lines by trimming them. Change-Id: I002b1d1980071084c0bc53242c8f5900970e6845 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+191
Per CQ 3448 this is the initial contribution of the JGit project to eclipse.org. It is derived from the historical JGit repository at commit 3a2dd9921c8a08740a9e02c421469e5b1a9e47cb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>