aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/treewalk
Commit message (Collapse)AuthorAgeFilesLines
* Delete deprecated WorkingTreeIterator.isModified(DirCacheEntry, boolean)Matthias Sohn2015-06-031-27/+0
| | | | Change-Id: I687c392e5a625fd66c45998c94373aa59921b986 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix potential null pointer access in IndexDiffFilterMatthias Sohn2015-05-261-1/+2
| | | | Change-Id: I39c2ea6b3090d7028cc1e246af6e3cc4e7bc70c2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace deprecated release() methods by close()Matthias Sohn2015-05-211-11/+0
| | | | | | | | 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>
* IndexDiffFilter: Simplify a boolean expressionSebastian Schuberth2015-05-081-1/+1
| | | | | Change-Id: Ibdd0338b638b864d6572045b084b08a04471ecf7 Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
* TreeWalk: Do not close reader passed explicitly to constructorDave Borowitz2015-03-101-4/+16
| | | | | | | | | The TreeWalk(ObjectReader) constructor is explicitly to handle the case where the caller is responsible for opening and closing the reader. The reader should only be closed when it was created in the TreeWalk(Repository) constructor. Change-Id: I627681be80d69ea549f953255a64c7b3b68bcec9
* TreeWalk: Stop using deprecated ObjectReader#release()Dave Borowitz2015-03-101-4/+1
| | | | Change-Id: I334034a2991a07664302bc8d1f3dead85c2caffe
* Implement AutoClosable interface on classes that used release()Matthias Sohn2015-02-091-3/+17
| | | | | | | | | Implement AutoClosable and deprecate the old release() method to give JGit consumers some time to adapt. Bug: 428039 Change-Id: Id664a91dc5a8cf2ac401e7d87ce2e3b89e221458 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add basic support for .gitattributesArthur Daussy2015-01-071-0/+160
| | | | | | | | | | | | | | | | | | | | | | Core classes to parse and process .gitattributes files including support for reading attributes in WorkingTreeIterator and the dirCacheIterator. The implementation follows the git ignore implementation. It supports lazy reading attributes while walking the working tree. Bug: 342372 CQ: 9078 Change-Id: I05f3ce1861fbf9896b1bcb7816ba78af35f3ad3d Also-by: Marc Strapetz <marc.strapetz@syntevo.com> Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org> Also-by: Arthur Daussy <arthur.daussy@obeo.fr> Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org> Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com> Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Consider parent rules if ignore rule is negatedAndrey Loskutov2014-11-291-2/+25
| | | | | | | | | | | | | | | | | The change tries to make jgit behave more like native CLI git regarding the negation rules. According to [1] "... prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again." Negating the pattern should not automatically make the file *not ignored* - other pattern rules have to be considered too. The fix adds test cases for both bugs 448094 and 407475. [1] https://www.kernel.org/pub/software/scm/git/docs/gitignore.html Bug: 448094 Bug: 407475 Change-Id: I322954200dd3c683e3d8f4adc48506eb99e56ae1 Signed-off-by: Andrey Loskutov <loskutov@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Reimplementation of ignore rule parserAndrey Loskutov2014-10-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | The current IgnoreRule/FileNameMatcher implementation scales not well with huge repositories - it is both slow and memory expensive while parsing glob expressions (bug 440732). Addtitionally, the "double star" pattern (/**/) is not understood by the old parser (bug 416348). The proposed implementation is a complete clean room rewrite of the gitignore parser, aiming to add missing double star pattern support and improve the performance and memory consumption. The glob expressions from .gitignore rules are converted to Java regular expressions (java.util.regex.Pattern). java.util.regex.Pattern code can evaluate expression from gitignore rules considerable faster (and with less memory consumption) as the old FileNameMatcher implementation. CQ: 8828 Bug: 416348 Bug: 440732 Change-Id: Ibefb930381f2f16eddb9947e592752f8ae2b76e1 Signed-off-by: Andrey Loskutov <loskutov@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Initialize 'pathLen' field also for empty directoriesAndrey Loskutov2014-10-231-0/+2
| | | | | Bug: 445363 Change-Id: Ia8428af84fb61ba0d572374a19e8e8c55b138a63 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Rename local variables/parameters to remove warnings about hidingRobin Rosenberg2014-09-041-3/+3
| | | | Change-Id: I73f38492b6a2e7fd6e77005efd0a8a8c65763e74
* Windows: Hide the .git directory if hidedotfiles is set to non-falseRobin Rosenberg2014-09-041-0/+14
| | | | | | Other .git files are not hidden with this patch Change-Id: Idf63ca08d08f3a77c33f5848d02074f8d6a75758 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* IndexDiffFilter should never filter entries with stage!=0Christian Halstrick2014-08-021-1/+5
| | | | | | | | | | | If the IndexDiffFilter is asked whether it should include or filter out a certain path and for that path there is a dircache entry with a stage different from 0, then the filter should never filter out this entry. IndexDiffFilter is an optimized version of AnyDiffFilter and there is no case where the index contains non-0 stages but we still don't see any diff for that path. Change-Id: I25915880f304090fe90584c79bddf021231227a2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix a number of failing conflict situationsRobin Rosenberg2014-05-171-0/+2
| | | | | | | | | | | | | Adds further tests where the working tree is dirty (differs from index) and where we have staged but uncommitted changes. Fixed the test case 9 for file/directory conflicts. Bug: 428819 Change-Id: Ie44a288b052abe936ebb74272d0fefef3b218a7a Signed-off-by: Axel Richard <axel.richard@obeo.fr> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Mark getParent deprecated in CanonicalTreeParserShawn Pearce2014-04-031-0/+1
| | | | | | | @deprecated in Javadoc must be accompanied by @Deprecated annotation on the class member. Change-Id: Ifdf787f496ff3ffd6ffe8f3321d56320cb08454f
* Cleanup javadocs so they pass the java8 doclint checksRobin Rosenberg2014-03-292-2/+2
| | | | | | Bug: 431552 Change-Id: I469316f5645205016e1fa6b0fbd2ff3b509b14bc Signed-off-by: Robin Stocker <robin@nibor.org>
* [findBugs] Declare some private methods of WorkingTreeIterator staticMatthias Sohn2014-03-051-6/+6
| | | | Change-Id: I09cd39c367f408b5a963ff004f235f558990f338 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-3.3'Matthias Sohn2014-03-051-14/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-3.3: Update scripts to deploy jgit on Maven central Prepare 3.3.1-SNAPSHOT builds JGit v3.3.0.201403021825-r Fix merge/cherry-picking in CRLF mode Expose the received pack size in ReceivePack Revert "Add getPackFile to ReceivePack to make PostReceiveHook more usable" Avoid an NPE after 7b01a5369210 Add a launcher for Java 7 tests Remove obsolete getRepositoryMethod from WorkingTreeIterator Fix NPE when WorkingTreeIterator does not have a repository set Add getPackFile to ReceivePack to make PostReceiveHook more usable Possibility to limit the max pack size on receive-pack Package httpclient and httpcore in o.e.j.http.apache.feature Change-Id: I814a150980854bbaabd767f97b062d247af6cb50 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Avoid an NPE after 7b01a5369210Robin Rosenberg2014-03-011-1/+2
| | | | | | | | | | | | | | | | While fixing an NPE, I introduced another one in a deprecated isModified method. It cannot avoid NPE's entirely, which is the reason the method is deprecated Change-Id: I5147c1c94621586dd84bd11e6090a954523b6c1c
| * Remove obsolete getRepositoryMethod from WorkingTreeIteratorRobin Rosenberg2014-02-281-9/+0
| | | | | | | | | | | | | | The method was added for symlink support, but isn't needed anymore. Since it was added for this release it's like it never existed. Change-Id: I422cd1dcdfa40b25ba3d6e08b112159dae9a4353 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Fix NPE when WorkingTreeIterator does not have a repository setRobin Rosenberg2014-02-281-4/+5
| | | | | | | | | | | | | | It's strange that we have that member since it is not so clear when it it set or not. Change-Id: I53903a264f46866d249901a3cd9f9295028aa6bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Add missing @Deprecated to deprecated fields and methodsShawn Pearce2014-03-031-0/+1
|/ | | | | | | | Java spec requires the @Deprecated annotation on any deprecated field or method. Add the missing annotation to fields and methods already declared deprecated in the javadoc. Change-Id: Ic0ef24b43cfd99ac947e771ef5a28e493c304274
* Normalize paths on OS XRobin Rosenberg2014-02-122-7/+8
| | | | | | | Java normalizes paths to NFC, but other source may not, e.g Eclipse. Bug: 413390 Change-Id: I08649ac58c9b3cb8bf12794703e4137b1b4e94d5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Recognize symlinks in the FileTreeIteratorRobin Rosenberg2014-02-121-1/+3
| | | | | | We did this for the Eclipse Platform in the ContainerTreeIterator. Change-Id: I80d8157cc0dd99d57e2ed5d7cd8b13525a0c62b1
* Add special case to WorkingTreeIterator for matching unnormalized symlinksRobin Rosenberg2014-02-121-3/+33
| | | | | | | | | If there is an unnormalized symbolic link in the index, lie that it matches a normalized link in the working tree. This does not make the case completely invisible everywhere though, but it helps to some degree. Change-Id: I599fb71648c41fa2310049d0e0040b3c9f09386b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use fileAttributes to get more attributes in one goRobin Rosenberg2014-02-121-46/+19
| | | | | | | | | On Windows the length reported by FileAttributes is the size of the target file (a bug, I guess) rather than the link, so we read the linke and look at the length of the link instead. Bug: 353771 Change-Id: I834b06d0447f84379612b8c9190fa77093617595 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add symlink support to JGitRobin Rosenberg2014-02-103-20/+67
| | | | | | | | | | | | | | | | | | | | The change includes comparing symbolic links between disk and index, adding symbolic links to the index, creating/modifying links on checkout. The behavior is controlled by the core.symlinks setting, just as C Git does. When a new repository is created core.symlinks will be set depending on the capabilities of the operating system and Java runtime. If core.symlinks is set to true, the assumption is that symlinks are supported, which may result in runtime errors if this turns out not to be the case. Measuring the cost of jgit status on a repository with ~70000 files, of which ~30000 are tracked reveals a penalty of about 10% for using the Java7 (really NIO2) support module. Bug: 354367 Change-Id: I12f0fdd9d26212324a586896ef7eb1f6ff89c39c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use the new FS.exists method in commonly occuring placesRobin Rosenberg2014-02-102-2/+2
| | | | | | Allegedly this should improve performance, but I could not see it. Change-Id: Id2057cb2cfcb46e94ff954483ce23f9c4a7edc5e
* Fix deprecated WTI#isModifiedRobin Rosenberg2014-02-101-1/+1
| | | | | | | We should really pass the forceContentCheck parameter to the real method. Change-Id: I9ea439cf6340a18d0e931edde3b9e3486cafde93 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Reset internal state canonical length in WorkingTreeIterator when movingRobin Rosenberg2014-02-031-1/+1
| | | | | Bug: 426514 Change-Id: Ifb75a4fa12291aeeece3dda129a65f0c1fd5e0eb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix for core.autocrlf=input resulting in modified fileRobin Rosenberg2014-02-022-9/+81
| | | | | | | | | | | 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-2/+3
| | | | | Change-Id: I7e3f6b9fb1ac4b99d2cc9a78c63aad86f4fa5744 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Improve documentation of PathSuffixFilterRobin Stocker2013-07-211-3/+11
| | | | | | Change-Id: I1077dbb1f10c7cc687c0d1b8a8e8f763ca96977c Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilterRobin Stocker2013-07-081-3/+7
| | | | | | | | | | | * It didn't check the first character in the pattern due to a off-by-one error. Spotted by James Roper. * It returned true even when pattern was longer than current path, e.g. it returned that ".txt" is suffix of "txt". Bug: 411999 Change-Id: I9fbcd68a11fb57cc49956b70c387a47271a0424f Signed-off-by: Robin Stocker <robin@nibor.org>
* Refer to getEntryPathLength in docs of getEntryPathBufferRobin Stocker2013-04-271-1/+8
| | | | Change-Id: Icca41d80bd0791cd2d4bf03297795d161afbee70
* Add a constant for info/excludeRobin Rosenberg2013-04-081-2/+2
| | | | Change-Id: Ifd537ce4e726cb9460ea332f683428689bd3d7f4
* Fix PathFilterGroup not to throw StopWalkException too earlyRobin Rosenberg2013-04-031-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to the Git internal sort order a directory is sorted as if it ended with a '/', this means that the path filter didn't set the last possible matching entry to the correct value. In the reported issue we had the following filters. org.eclipse.jgit.console org.eclipse.jgit As an optimization we throw a StopWalkException when the walked tree passes the last possible filter, which was this: org.eclipse.jgit.console Due to the git sorting order, the tree was processed in this order: org.eclipse.jgit.console org.eclipse.jgit.test org.eclipse.jgit At org.eclipse.jgit.test we threw the StopWalkException preventing the walk from completing successfully. A correct last possible match should be: org.eclipse.jgit/ For simplicit we define it as: org/eclipse/jgit/ This filter would be the maximum if we also had e.g. org and org.eclipse in the filter, but that would require more work so we simply replace all characters lower than '/' by a slash. We believe the possible extra walking does not not warrant the extra analysis. Bug: 362430 Change-Id: I4869019ea57ca07d4dff6bfa8e81725f56596d9f
* Add missing @since tagsMatthias Sohn2013-03-221-1/+1
| | | | Change-Id: I6b20d78e6bd1f245fdca331554c106f8bae44b9c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Improve the documentation of the ByteArraySet used by PathFilterGroupRobin Rosenberg2013-02-221-4/+12
| | | | Change-Id: I2ba7a67e8e1596aa6c33a9caddee03a6be48f008
* Merge branch 'stable-2.3'Matthias Sohn2013-02-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | * stable-2.3: Prepare 2.3.2-SNAPSHOT builds JGit v2.3.1.201302201838-r Accept Change-Id even if footer contains not well-formed entries Fix false positives in hashing used by PathFilterGroup Change-Id: I5882aa3b482d6bcd40a45bed51e5ab03f018a5bc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Fix false positives in hashing used by PathFilterGroupRobin Stocker2013-02-201-1/+1
| | | | | | | | | | | | | | | | | | The ByteArraySet failed to check the length of the entry correctly leading to matches where no match should be. Bug: 401249 Change-Id: I925bc48d9cafcdf13e1a797bb09fc2555eb270c5 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Implement core.checkstat = minimalRobin Rosenberg2013-02-102-5/+29
|/ | | | | | | | | | | | | | | | | | There is a huge performance issue when using both JGit (EGit) and Git because JGit does not fill all dircache stat fields with the values Git would expect. As a result thereof Git would typically revalidate a large number of tracked files. This can take several minutes for large repositories with many large files. Since 1.8.2 Git will restrict stat checking to the size and whole second part of the modification time stamp, if core.statinfo is set to "minimal". As JGit checks only size and modification time this is close to what JGit already does. To make the match perfect ignore the sub-second part of the modification time stamp if core.statinfo = minimal. Change-Id: I8eaff1858a891571075a86db043f9d80da3d7503
* Merge changes Ife0cc2da,If38507efRobin Rosenberg2013-01-282-30/+387
|\ | | | | | | | | | | * changes: Speed up PathFilterGroup for large sets of paths Add test case for PathFilterGroup
| * Speed up PathFilterGroup for large sets of pathsRobin Rosenberg2013-01-212-30/+387
| | | | | | | | | | | | | | The ByteArraySet is a distorted copy of ObjectIdSubclassMap. Bug: 397185 Change-Id: Ife0cc2da6cc46431be94a6b14f64f6adbe983afb
* | Enable marking entries using TreeFilters in DiffEntryRobin Stocker2013-01-231-0/+122
|/ | | | | | | | | | | | | | | | | | | | This adds a new optional TreeFilter[] argument to DiffEntry.scan. All filters will be checked during the scan to determine if an entry should be "marked" with regard to that filter. After having called scan, the user can then call isMarked(int) on the entries to find out whether they matched the TreeFilter with the passed index. An example use case for this is in the file diff viewer of EGit's History view, where we'd like to highlight entries that are matching the current filter. See EGit change I03da4b38d1591495cb290909f0e4c6e52270e97f. Bug: 393610 Change-Id: Icf911fe6fca131b2567514f54d66636a44561af1 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Define a tree filter for user-visible changes between two indexesRobin Rosenberg2013-01-151-0/+105
| | | | | | | | | | The primary purpose of the filter is to detect an index change that could possibly lead to a change in what files are visible in the staging view and decorations. Besides what TreeFilter.ANY_DIFF does for trees in general, this filter also looks at the assume-valid (CE_VALID) flag to see whether changes should be ignored or not. Change-Id: I13e9ed4ae62dc3851204fba598239edce07ca977
* Merge "Revert "Speed up PathFilterGroup.include for large set of paths""Robin Rosenberg2013-01-091-55/+15
|\
| * Revert "Speed up PathFilterGroup.include for large set of paths"Robin Rosenberg2013-01-091-55/+15
| | | | | | | | | | | | | | | | This reverts commit 576e5acdd054e2dcd8cde3fe4d822bc3609850c1 The comparator is broken. Change-Id: Ic59110b154613f3ff4a215a6c1293a4c15cd3885
* | Merge "Consider that some Java version on Linux only return integral timestamps"Robin Rosenberg2013-01-081-1/+4
|\ \ | |/ |/|