diff options
author | Russell Belfer <rb@github.com> | 2012-05-25 04:14:56 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-05-25 04:14:56 +0400 |
commit | 2a99df6909af4c93ce2741ddc5d15a7f52270f28 (patch) | |
tree | 3b1fc3f206d156b356b4a342ea94eadad99192f1 /src/attr_file.h | |
parent | a4452eb1b929b95f69768d398008f6f8844941e4 (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 'src/attr_file.h')
-rw-r--r-- | src/attr_file.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/attr_file.h b/src/attr_file.h index 3718f4bda..7939f838a 100644 --- a/src/attr_file.h +++ b/src/attr_file.h @@ -22,6 +22,7 @@ #define GIT_ATTR_FNMATCH_MACRO (1U << 3) #define GIT_ATTR_FNMATCH_IGNORE (1U << 4) #define GIT_ATTR_FNMATCH_HASWILD (1U << 5) +#define GIT_ATTR_FNMATCH_ALLOWSPACE (1U << 6) typedef struct { char *pattern; @@ -88,6 +89,8 @@ extern int git_attr_file__new_and_load( extern void git_attr_file__free(git_attr_file *file); +extern void git_attr_file__clear_rules(git_attr_file *file); + extern int git_attr_file__parse_buffer( git_repository *repo, const char *buf, git_attr_file *file); |