diff options
author | Russell Belfer <arrbee@arrbee.com> | 2011-12-16 10:56:43 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2011-12-20 16:32:58 -0800 |
commit | ee1f0b1aed7798908d9e038b006b66f868613fc3 (patch) | |
tree | c60350029b9e4bb14811ac13caf59ad86424f33e /tests | |
parent | be00b00dd1468f1c625ca3fadc61f2a16edfb8d5 (diff) | |
download | libgit2-ee1f0b1aed7798908d9e038b006b66f868613fc3.tar.gz |
Add APIs for git attributes
This adds APIs for querying git attributes. In addition to
the new API in include/git2/attr.h, most of the action is in
src/attr_file.[hc] which contains utilities for dealing with
a single attributes file, and src/attr.[hc] which contains
the implementation of the APIs that merge all applicable
attributes files.
Diffstat (limited to 'tests')
36 files changed, 92 insertions, 0 deletions
diff --git a/tests/resources/attr/.gitattributes b/tests/resources/attr/.gitattributes new file mode 100644 index 000000000..f2c6d717c --- /dev/null +++ b/tests/resources/attr/.gitattributes @@ -0,0 +1,4 @@ +* rootattr +root_test2 -rootattr +root_test3 !rootattr + diff --git a/tests/resources/attr/.gitted/HEAD b/tests/resources/attr/.gitted/HEAD new file mode 100644 index 000000000..cb089cd89 --- /dev/null +++ b/tests/resources/attr/.gitted/HEAD @@ -0,0 +1 @@ +ref: refs/heads/master diff --git a/tests/resources/attr/.gitted/config b/tests/resources/attr/.gitted/config new file mode 100644 index 000000000..af107929f --- /dev/null +++ b/tests/resources/attr/.gitted/config @@ -0,0 +1,6 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true diff --git a/tests/resources/attr/.gitted/description b/tests/resources/attr/.gitted/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/tests/resources/attr/.gitted/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/tests/resources/attr/.gitted/index b/tests/resources/attr/.gitted/index Binary files differnew file mode 100644 index 000000000..6841fb2ec --- /dev/null +++ b/tests/resources/attr/.gitted/index diff --git a/tests/resources/attr/.gitted/info/attributes b/tests/resources/attr/.gitted/info/attributes new file mode 100644 index 000000000..93efc0c34 --- /dev/null +++ b/tests/resources/attr/.gitted/info/attributes @@ -0,0 +1,2 @@ +* repoattr + diff --git a/tests/resources/attr/.gitted/info/exclude b/tests/resources/attr/.gitted/info/exclude new file mode 100644 index 000000000..a5196d1be --- /dev/null +++ b/tests/resources/attr/.gitted/info/exclude @@ -0,0 +1,6 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ diff --git a/tests/resources/attr/.gitted/logs/HEAD b/tests/resources/attr/.gitted/logs/HEAD new file mode 100644 index 000000000..cfd1f9525 --- /dev/null +++ b/tests/resources/attr/.gitted/logs/HEAD @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data diff --git a/tests/resources/attr/.gitted/logs/refs/heads/master b/tests/resources/attr/.gitted/logs/refs/heads/master new file mode 100644 index 000000000..cfd1f9525 --- /dev/null +++ b/tests/resources/attr/.gitted/logs/refs/heads/master @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6bab5c79cd5140d0f800917f550eb2a3dc32b0da Russell Belfer <arrbee@arrbee.com> 1324416995 -0800 commit (initial): initial test data diff --git a/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b b/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b Binary files differnew file mode 100644 index 000000000..ad84f0854 --- /dev/null +++ b/tests/resources/attr/.gitted/objects/29/29de282ce999e95183aedac6451d3384559c4b diff --git a/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 b/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 Binary files differnew file mode 100644 index 000000000..4b75d50eb --- /dev/null +++ b/tests/resources/attr/.gitted/objects/2c/66e14f77196ea763fb1e41612c1aa2bc2d8ed2 diff --git a/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 b/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 Binary files differnew file mode 100644 index 000000000..e0fd0468e --- /dev/null +++ b/tests/resources/attr/.gitted/objects/2d/e7dfe3588f3c7e9ad59e7d50ba90e3329df9d9 diff --git a/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 b/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 Binary files differnew file mode 100644 index 000000000..e5cef35fa --- /dev/null +++ b/tests/resources/attr/.gitted/objects/3b/74db7ab381105dc0d28f8295a77f6a82989292 diff --git a/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d b/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d Binary files differnew file mode 100644 index 000000000..5b58ef024 --- /dev/null +++ b/tests/resources/attr/.gitted/objects/45/141a79a77842c59a63229403220a4e4be74e3d diff --git a/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 b/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 Binary files differnew file mode 100644 index 000000000..4bcff1faa --- /dev/null +++ b/tests/resources/attr/.gitted/objects/55/6f8c827b8e4a02ad5cab77dca2bcb3e226b0b3 diff --git a/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da b/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da new file mode 100644 index 000000000..f51e11ccc --- /dev/null +++ b/tests/resources/attr/.gitted/objects/6b/ab5c79cd5140d0f800917f550eb2a3dc32b0da @@ -0,0 +1,3 @@ +x 0E)@d'~@(#tQiQn(Pm"Ř2hsL+d{"{Z`u +O4Y[;@>MSOmʧh +*<-
\ No newline at end of file diff --git a/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 b/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 Binary files differnew file mode 100644 index 000000000..11dc63c79 --- /dev/null +++ b/tests/resources/attr/.gitted/objects/c0/091889c0c77142b87a1fa5123a6398a61d33e7 diff --git a/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c b/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c Binary files differnew file mode 100644 index 000000000..58569ca0e --- /dev/null +++ b/tests/resources/attr/.gitted/objects/c4/85abe35abd4aa6fd83b076a78bbea9e2e7e06c diff --git a/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d b/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d Binary files differnew file mode 100644 index 000000000..39aedb7d9 --- /dev/null +++ b/tests/resources/attr/.gitted/objects/c7/aadd770d5907a8475c29e9ee21a27b88bf675d diff --git a/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 b/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 Binary files differnew file mode 100644 index 000000000..ef62f8b9d --- /dev/null +++ b/tests/resources/attr/.gitted/objects/dc/cada462d3df8ac6de596fb8c896aba9344f941 diff --git a/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 b/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 Binary files differnew file mode 100644 index 000000000..1bc1f0f0b --- /dev/null +++ b/tests/resources/attr/.gitted/objects/e5/63cf4758f0d646f1b14b76016aa17fa9e549a4 diff --git a/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 b/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 Binary files differnew file mode 100644 index 000000000..27a25dc86 --- /dev/null +++ b/tests/resources/attr/.gitted/objects/f2/c6d717cf4a5a3e6b02684155ab07b766982165 diff --git a/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 b/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 Binary files differnew file mode 100644 index 000000000..6c8ff837e --- /dev/null +++ b/tests/resources/attr/.gitted/objects/fb/5067b1aef3ac1ada4b379dbcb7d17255df7d78 diff --git a/tests/resources/attr/.gitted/refs/heads/master b/tests/resources/attr/.gitted/refs/heads/master new file mode 100644 index 000000000..279272e5c --- /dev/null +++ b/tests/resources/attr/.gitted/refs/heads/master @@ -0,0 +1 @@ +6bab5c79cd5140d0f800917f550eb2a3dc32b0da diff --git a/tests/resources/attr/attr0 b/tests/resources/attr/attr0 new file mode 100644 index 000000000..556f8c827 --- /dev/null +++ b/tests/resources/attr/attr0 @@ -0,0 +1 @@ +* binary diff --git a/tests/resources/attr/attr1 b/tests/resources/attr/attr1 new file mode 100644 index 000000000..3b74db7ab --- /dev/null +++ b/tests/resources/attr/attr1 @@ -0,0 +1,29 @@ +# a comment followed by some blank lines + + + + # another comment that is indented + +# variations on fnmatch + +pat0 attr0 +!pat1 attr1 +pat2/ attr2 +pat3dir/pat3file attr3 +pat4.* attr4 + *.pat5 attr5 +pat6/pat6/*.pat6 attr6 + +pat7[a-e]??[xyz] attr7 # with a comment on the line + +pat8\ with\ spaces attr8 + + invalid # attr with no assignments doesn't count + +also/invalid + +invalid.again/ + +# next attr is at eof + + pat9 attr9
\ No newline at end of file diff --git a/tests/resources/attr/attr2 b/tests/resources/attr/attr2 new file mode 100644 index 000000000..2c66e14f7 --- /dev/null +++ b/tests/resources/attr/attr2 @@ -0,0 +1,21 @@ + +# variations on assignments + +pat0 simple +pat1 -neg +* notundef +pat2 !notundef +pat3 assigned=test-value +pat4 rule-with-more-chars=value-with-more-chars +pat5 empty= +pat6 -negempty= +pat7 multiple -single values=1 also=a-really-long-value/* happy=yes! +# the next line has trailing spaces +pat8 again= another=12321 +patbad0 # empty assignment does not count +# next line will be another simple empty assign that should not count + patbad1 + +# BTW I think there are 11 valid rules and two "invalid" empty ones + +pat9 -at-eof
\ No newline at end of file diff --git a/tests/resources/attr/attr3 b/tests/resources/attr/attr3 new file mode 100644 index 000000000..c485abe35 --- /dev/null +++ b/tests/resources/attr/attr3 @@ -0,0 +1,4 @@ +# These are examples from the git-check-attr.1 man page +*.java diff=java -crlf myAttr +NoMyAttr.java !myAttr +README caveat=unspecified diff --git a/tests/resources/attr/root_test1 b/tests/resources/attr/root_test1 new file mode 100644 index 000000000..45141a79a --- /dev/null +++ b/tests/resources/attr/root_test1 @@ -0,0 +1 @@ +Hello from the root diff --git a/tests/resources/attr/root_test2 b/tests/resources/attr/root_test2 new file mode 100644 index 000000000..45141a79a --- /dev/null +++ b/tests/resources/attr/root_test2 @@ -0,0 +1 @@ +Hello from the root diff --git a/tests/resources/attr/root_test3 b/tests/resources/attr/root_test3 new file mode 100644 index 000000000..45141a79a --- /dev/null +++ b/tests/resources/attr/root_test3 @@ -0,0 +1 @@ +Hello from the root diff --git a/tests/resources/attr/root_test4.txt b/tests/resources/attr/root_test4.txt new file mode 100644 index 000000000..fb5067b1a --- /dev/null +++ b/tests/resources/attr/root_test4.txt @@ -0,0 +1 @@ +Hello again diff --git a/tests/resources/attr/subdir/.gitattributes b/tests/resources/attr/subdir/.gitattributes new file mode 100644 index 000000000..210f3a8ba --- /dev/null +++ b/tests/resources/attr/subdir/.gitattributes @@ -0,0 +1,3 @@ +* subattr=yes -negattr +subdir/*.txt another=one + diff --git a/tests/resources/attr/subdir/subdir_test1 b/tests/resources/attr/subdir/subdir_test1 new file mode 100644 index 000000000..e563cf475 --- /dev/null +++ b/tests/resources/attr/subdir/subdir_test1 @@ -0,0 +1,2 @@ +Hello from the subdir + diff --git a/tests/resources/attr/subdir/subdir_test2.txt b/tests/resources/attr/subdir/subdir_test2.txt new file mode 100644 index 000000000..fb5067b1a --- /dev/null +++ b/tests/resources/attr/subdir/subdir_test2.txt @@ -0,0 +1 @@ +Hello again diff --git a/tests/resources/attr/subdir2/subdir2_test1 b/tests/resources/attr/subdir2/subdir2_test1 new file mode 100644 index 000000000..dccada462 --- /dev/null +++ b/tests/resources/attr/subdir2/subdir2_test1 @@ -0,0 +1 @@ +Hello from subdir2 |