aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes
Commit message (Collapse)AuthorAgeFilesLines
* MergeGitAttributeTest: Open FileInputStream in try-with-resourceDavid Pursehouse2018-02-261-27/+17
| | | | | Change-Id: Iec85eea044c46a199b5b6f6bdbb3191d817dd441 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* PathMatcher: fix handling of **/Marc Strapetz2018-02-221-0/+28
| | | | | | | **/ should match only directories, but not files Change-Id: I885c83e5912cac5bff338ba657faf6bb9ec94064 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* Merge branch 'stable-4.9'Matthias Sohn2017-12-232-0/+41
|\ | | | | | | | | | | | | | | * stable-4.9: Strings#convertGlob: fix escaping of patterns like [\[]. Change-Id: I18d55537002b3153db35f8a6b60f2f5317d17248 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Strings#convertGlob: fix escaping of patterns like [\[].Dmitry Pavlenko2017-12-212-0/+41
| | | | | | | | | | | | | | | | | | | | Originally the patterns were escaped twice leading to wrong matching results. Bug: 528886 Change-Id: I26e201b4b0ef51cac08f940b76f381260fa925ca Signed-off-by: Dmitry Pavlenko <pavlenko@tmatesoft.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Make local assert methods private in test classesDavid Pursehouse2017-12-011-2/+2
|/ | | | | Change-Id: I1bed28a1eac3c7f84cc40841853b9540c72be265 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix some tests for running in bazelThomas Wolf2017-08-311-3/+4
| | | | | | | | | | | | | | | | | Some tests call out to external cgit. Those tests all failed for me locally on Mac. Turned out that the reason was that the system git config used by the git in the bazel run contained paths with ~/ but somehow $HOME was not set. As a result the external git returned with exit code 128. Fix this by passing along $HOME explicitly. Also improve assertions to make sure we do get the stderr of the external command in the test log. I hadn't noticed that until now because apparently the maven build does pass along $HOME. Change-Id: I7069676d5cc7b23a71e79a4866fe8acab5a405f4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Cleanup: Organize importsMatthias Sohn2017-08-301-1/+1
| | | | Change-Id: I6065e59519bc42bd18f5cc5ee3ec5210764ab03c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Exclude file matching: fix backtracking on match failures after **Thomas Wolf2017-08-272-0/+89
| | | | | | | | | | ** matching always tries the empty match first. If a mismatch occurs later, the ** must be extended by exactly one segment and matching must resume with the matcher following the ** matcher. Bug: 520920 Change-Id: Id019ad1c773bd645ae92e398021952f8e961f45c Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix path pattern matching to work also for gitattributesThomas Wolf2017-08-273-43/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | Path pattern matching for attribute rules is different than matching for excluded files. The first difference concerns patterns without slashes. For gitattributes those must match on the last component only, not on any earlier segment. This is true also for directory-only patterns. The second difference concerns directory-only patterns. Those also must not match on a prefix or segment except the last one. They do not apply recursively to all files beneath. And third, matches only on a prefix must match for gitattributes only if the last matcher was "/**". Add a new parameter for such path matching to IMatcher.matches() and pass it through as appropriate (false for gitignore, true for gitattributes). As far as gitignore is concerned, there is no change. New tests have been added, and some existing attribute matching tests have been fixed since they operated on wrong assumptions. Bug: 508568 Change-Id: Ie825dc2cac8a85a72a7eeb0abb888f3193d21dd2 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Add new tests for gitignore/gitattribute pattern matchingThomas Wolf2017-08-271-0/+241
| | | | | | | | | | | | | | | | | | | | These tests verify that JGit matches the same as C git, for both attribute matching (.gitattributes) and file exclusion matching (.gitignore). These tests work by setting up a test repository and test rules, and then determine excluded files or attributes both with JGit and with the native C git, and then compare the results. For .gitignore tests, we run git ls-files --ignored --exclude-standard -o and for attribute tests we use git check-attr --stdin --all and pass the list of all files in the repository via stdin. Change-Id: I5b40946e04ff4a97456be7dffe09374323b7c89d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Use relative paths for attribute rule matchingThomas Wolf2017-08-111-0/+27
| | | | | | | | | | Attribute rules must match against the entry path relative to the attribute node containing the rule. The global entry path is to be used only for the init and the global node (and of course the root node). Bug: 520677 Change-Id: I80389a2dc272a72312729ccd5358d7c75e1ea20a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix matching ignores and attributes pattern of form a/b/**.Dmitry Pavlenko2017-07-241-0/+19
| | | | | | | | | | Fix patch matching for patterns of form a/b/** : this should not match paths like a/b but still match a/b/ and a/b/c. Change-Id: Iacbf496a43f01312e7d9052f29c3f9c33807c85d Signed-off-by: Dmitry Pavlenko <pavlenko@tmatesoft.com> Signed-off-by: Andrey Loskutov <loskutov@gmx.de> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Support -merge attribute in binary macroMathieu Cartaud2017-06-271-0/+585
| | | | | | | | | | | | | | The merger is now able to react to the use of the merge attribute. The value unset and the custom value 'binary' are handled (-merge and merge=binary) Since the specification of the merge attribute states that when the attribute is unset, ours version must be kept in case of a conflict, we don't overwrite the file but keep the local version. Bug: 517128 Change-Id: Ib5fbf17bdaf727bc5d0e106ce88f2620d9f87a6f Signed-off-by: Mathieu Cartaud <mathieu.cartaud@obeo.fr>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-3/+3
| | | | | | | | | | 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>
* Add Attribute Macro ExpansionIvan Motsch2016-02-115-17/+367
| | | | | | | | | | Attributes MacroExpander implements macros used in git attributes. This is implemented inside the TreeWalk using a lazy created MacroExpander. In addition, the macro expander caches the global and info attributes node in order to provide fast merge of attributes. Change-Id: I2e69c9fc84e9d7fb8df0a05817d688fc456d8f00 Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
* Fix unused throws CorruptObjectException from addTreeShawn Pearce2016-01-201-2/+1
| | | | | | | | 2262a794b48ea removed throws CorruptObjectException, but was not compiled under Eclipse and did not see errors generated by Eclipse. Maven build silently ignored the unnecessary code. Change-Id: I6e9014adcc604588e10e5963d13d0c6ef0e1c617
* Add the new class Attributes holding multiple Attribute(s)Ivan Motsch2015-11-274-29/+23
| | | | | | | | | | Attributes represents a semantic collector of Attribute(s) and replaces the anonymous Map<String,Attribute>. This class will be returned by TreeWalk.getAttributes(). It offers convenient access to the attributes wrapped in the Attributes object. Adds preparations for a future Attribute Macro Expansion Change-Id: I8348c8c457a2a7f1f0c48050e10399b0fa1cdbe1 Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
* Adds the git attributes computation on the treewalkArthur Daussy2015-11-184-39/+887
| | | | | | | | | | | | Adds the getAttributes feature to the tree walk. The computation of attributes needs to be done by the TreeWalk since it needs both a WorkingTreeIterator and a DirCacheIterator. Bug: 342372 CQ: 9120 Change-Id: I5e33257fd8c9895869a128bad3fd1e720409d361 Signed-off-by: Arthur Daussy <arthur.daussy@obeo.fr> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Delete deprecated class IgnoreRuleMatthias Sohn2015-04-251-3/+0
| | | | | | Was replaced by FastIgnoreRule in 3.6 Change-Id: Ia9c3d1231a5d97f3f5bddc81113954c9f9d8ee1e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add basic support for .gitattributesArthur Daussy2015-01-075-0/+1249
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>