Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-25 04:14:56 +0400
committerRussell Belfer <rb@github.com>2012-05-25 04:14:56 +0400
commit2a99df6909af4c93ce2741ddc5d15a7f52270f28 (patch)
tree3b1fc3f206d156b356b4a342ea94eadad99192f1 /tests-clar/attr
parenta4452eb1b929b95f69768d398008f6f8844941e4 (diff)
Fix bugs for status with spaces and reloaded attrs
This fixes two bugs: * Issue #728 where git_status_file was not working for files that contain spaces. This was caused by reusing the "fnmatch" parsing code from ignore and attribute files to interpret the "pathspec" that constrained the files to apply the status to. In that code, unescaped whitespace was considered terminal to the pattern, so a file with internal whitespace was excluded from the matched files. The fix was to add a mode to that code that allows spaces and tabs inside patterns. This mode only comes into play when parsing in-memory strings. * The other issue was undetected, but it was in the recently added code to reload gitattributes / gitignores when they were changed on disk. That code was not clearing out the old values from the cached file content before reparsing which meant that newly added patterns would be read in, but deleted patterns would not be removed. The fix was to clear the vector of patterns in a cached file before reparsing the file.
Diffstat (limited to 'tests-clar/attr')
-rw-r--r--tests-clar/attr/attr_expect.h7
-rw-r--r--tests-clar/attr/file.c2
-rw-r--r--tests-clar/attr/lookup.c2
-rw-r--r--tests-clar/attr/repo.c2
4 files changed, 7 insertions, 6 deletions
diff --git a/tests-clar/attr/attr_expect.h b/tests-clar/attr/attr_expect.h
index df1e1044b..70f1ab4f5 100644
--- a/tests-clar/attr/attr_expect.h
+++ b/tests-clar/attr/attr_expect.h
@@ -18,19 +18,20 @@ struct attr_expected {
GIT_INLINE(void) attr_check_expected(
enum attr_expect_t expected,
const char *expected_str,
+ const char *name,
const char *value)
{
switch (expected) {
case EXPECT_TRUE:
- cl_assert(GIT_ATTR_TRUE(value));
+ cl_assert_(GIT_ATTR_TRUE(value), name);
break;
case EXPECT_FALSE:
- cl_assert(GIT_ATTR_FALSE(value));
+ cl_assert_(GIT_ATTR_FALSE(value), name);
break;
case EXPECT_UNDEFINED:
- cl_assert(GIT_ATTR_UNSPECIFIED(value));
+ cl_assert_(GIT_ATTR_UNSPECIFIED(value), name);
break;
case EXPECT_STRING:
diff --git a/tests-clar/attr/file.c b/tests-clar/attr/file.c
index d19708838..8866fd9bd 100644
--- a/tests-clar/attr/file.c
+++ b/tests-clar/attr/file.c
@@ -114,7 +114,7 @@ static void check_one_assign(
cl_assert_equal_s(name, assign->name);
cl_assert(assign->name_hash == git_attr_file__name_hash(assign->name));
- attr_check_expected(expected, expected_str, assign->value);
+ attr_check_expected(expected, expected_str, assign->name, assign->value);
}
void test_attr_file__assign_variants(void)
diff --git a/tests-clar/attr/lookup.c b/tests-clar/attr/lookup.c
index b2a6aac64..40aac0b6e 100644
--- a/tests-clar/attr/lookup.c
+++ b/tests-clar/attr/lookup.c
@@ -44,7 +44,7 @@ static void run_test_cases(git_attr_file *file, struct attr_expected *cases, int
error = git_attr_file__lookup_one(file,&path,c->attr,&value);
cl_git_pass(error);
- attr_check_expected(c->expected, c->expected_str, value);
+ attr_check_expected(c->expected, c->expected_str, c->attr, value);
git_attr_path__free(&path);
}
diff --git a/tests-clar/attr/repo.c b/tests-clar/attr/repo.c
index a88dfb3f9..c37ff544a 100644
--- a/tests-clar/attr/repo.c
+++ b/tests-clar/attr/repo.c
@@ -65,7 +65,7 @@ void test_attr_repo__get_one(void)
for (scan = test_cases; scan->path != NULL; scan++) {
const char *value;
cl_git_pass(git_attr_get(&value, g_repo, 0, scan->path, scan->attr));
- attr_check_expected(scan->expected, scan->expected_str, value);
+ attr_check_expected(scan->expected, scan->expected_str, scan->attr, value);
}
cl_assert(git_attr_cache__is_cached(g_repo, 0, ".git/info/attributes"));