summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-01-16 16:58:27 -0800
committerRussell Belfer <arrbee@arrbee.com>2012-01-16 16:58:27 -0800
commita51cd8e6f6724079a552b75e014f792f3f68e158 (patch)
treefcf526f2a7575e215d95589d1a8e07277981fd18 /tests
parent6e03b12f5715cb3f5cb5c8be6512e041cdf44a05 (diff)
downloadlibgit2-a51cd8e6f6724079a552b75e014f792f3f68e158.tar.gz
Fix handling of relative paths for attrs
Per issue #533, the handling of relative paths in attribute and ignore files was not right. Fixed this by pre-joining the relative path of the attribute/ignore file onto the match string when a full path match is required. Unfortunately, fixing this required a bit more code than I would have liked because I had to juggle things around so that the fnmatch parser would have sufficient information to prepend the relative path when it was needed.
Diffstat (limited to 'tests')
-rw-r--r--tests/resources/attr/.gitted/info/attributes2
-rw-r--r--tests/resources/attr/file1
-rw-r--r--tests/resources/attr/gitignore2
-rw-r--r--tests/resources/attr/ign1
-rw-r--r--tests/resources/attr/sub/.gitattributes (renamed from tests/resources/attr/subdir/.gitattributes)4
-rw-r--r--tests/resources/attr/sub/abc (renamed from tests/resources/attr/subdir/abc)0
-rw-r--r--tests/resources/attr/sub/file1
-rw-r--r--tests/resources/attr/sub/ign1
-rw-r--r--tests/resources/attr/sub/sub/file1
-rw-r--r--tests/resources/attr/sub/sub/subsub.txt1
-rw-r--r--tests/resources/attr/sub/subdir_test1 (renamed from tests/resources/attr/subdir/subdir_test1)0
-rw-r--r--tests/resources/attr/sub/subdir_test2.txt (renamed from tests/resources/attr/subdir/subdir_test2.txt)0
-rw-r--r--tests/resources/attr/subdir2/subdir2_test11
13 files changed, 13 insertions, 2 deletions
diff --git a/tests/resources/attr/.gitted/info/attributes b/tests/resources/attr/.gitted/info/attributes
index 2e9643a53..5fe62a37a 100644
--- a/tests/resources/attr/.gitted/info/attributes
+++ b/tests/resources/attr/.gitted/info/attributes
@@ -1,2 +1,4 @@
* repoattr
a* foo !bar -baz
+sub/*.txt reposub
+sub/sub/*.txt reposubsub
diff --git a/tests/resources/attr/file b/tests/resources/attr/file
new file mode 100644
index 000000000..45b983be3
--- /dev/null
+++ b/tests/resources/attr/file
@@ -0,0 +1 @@
+hi
diff --git a/tests/resources/attr/gitignore b/tests/resources/attr/gitignore
new file mode 100644
index 000000000..66f77694e
--- /dev/null
+++ b/tests/resources/attr/gitignore
@@ -0,0 +1,2 @@
+sub
+ign
diff --git a/tests/resources/attr/ign b/tests/resources/attr/ign
new file mode 100644
index 000000000..592fd2594
--- /dev/null
+++ b/tests/resources/attr/ign
@@ -0,0 +1 @@
+ignore me
diff --git a/tests/resources/attr/subdir/.gitattributes b/tests/resources/attr/sub/.gitattributes
index 99eae4768..329c1c5b8 100644
--- a/tests/resources/attr/subdir/.gitattributes
+++ b/tests/resources/attr/sub/.gitattributes
@@ -1,5 +1,7 @@
* subattr=yes -negattr
-subdir/*.txt another=one
+*.txt another=zero
+sub/*.txt another=one
ab* merge=filfre
abc -foo -bar
*.c frotz
+deep/file deepdeep
diff --git a/tests/resources/attr/subdir/abc b/tests/resources/attr/sub/abc
index 3e42ffc54..3e42ffc54 100644
--- a/tests/resources/attr/subdir/abc
+++ b/tests/resources/attr/sub/abc
diff --git a/tests/resources/attr/sub/file b/tests/resources/attr/sub/file
new file mode 100644
index 000000000..45b983be3
--- /dev/null
+++ b/tests/resources/attr/sub/file
@@ -0,0 +1 @@
+hi
diff --git a/tests/resources/attr/sub/ign b/tests/resources/attr/sub/ign
new file mode 100644
index 000000000..592fd2594
--- /dev/null
+++ b/tests/resources/attr/sub/ign
@@ -0,0 +1 @@
+ignore me
diff --git a/tests/resources/attr/sub/sub/file b/tests/resources/attr/sub/sub/file
new file mode 100644
index 000000000..45b983be3
--- /dev/null
+++ b/tests/resources/attr/sub/sub/file
@@ -0,0 +1 @@
+hi
diff --git a/tests/resources/attr/sub/sub/subsub.txt b/tests/resources/attr/sub/sub/subsub.txt
new file mode 100644
index 000000000..9e5bdc47d
--- /dev/null
+++ b/tests/resources/attr/sub/sub/subsub.txt
@@ -0,0 +1 @@
+subsub
diff --git a/tests/resources/attr/subdir/subdir_test1 b/tests/resources/attr/sub/subdir_test1
index e563cf475..e563cf475 100644
--- a/tests/resources/attr/subdir/subdir_test1
+++ b/tests/resources/attr/sub/subdir_test1
diff --git a/tests/resources/attr/subdir/subdir_test2.txt b/tests/resources/attr/sub/subdir_test2.txt
index fb5067b1a..fb5067b1a 100644
--- a/tests/resources/attr/subdir/subdir_test2.txt
+++ b/tests/resources/attr/sub/subdir_test2.txt
diff --git a/tests/resources/attr/subdir2/subdir2_test1 b/tests/resources/attr/subdir2/subdir2_test1
deleted file mode 100644
index dccada462..000000000
--- a/tests/resources/attr/subdir2/subdir2_test1
+++ /dev/null
@@ -1 +0,0 @@
-Hello from subdir2