diff options
| author | Vicent Martà <vicent@github.com> | 2012-06-11 09:26:42 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-06-11 09:26:42 -0700 |
| commit | 80779ea83ed606fadbb7affdbee22c3abb946284 (patch) | |
| tree | a4978879533c6558541e14fcf9551ad44b6f065b | |
| parent | e0b110edb1d0863ad454bfce0b0c3ac1ceef3392 (diff) | |
| parent | 9939e602d8aaffcc65e2db54ff670c8fa888299c (diff) | |
| download | libgit2-80779ea83ed606fadbb7affdbee22c3abb946284.tar.gz | |
Merge pull request #759 from libgit2/ignore-line-containing-space
git_status_file returns GIT_ENOTFOUND for files in "foo/" when .gitignore contains "foo bar.txt"
| -rw-r--r-- | src/ignore.c | 2 | ||||
| -rw-r--r-- | tests-clar/status/ignore.c | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/ignore.c b/src/ignore.c index fc6194bb5..f2d08f59e 100644 --- a/src/ignore.c +++ b/src/ignore.c @@ -28,6 +28,8 @@ static int parse_ignore_file( GITERR_CHECK_ALLOC(match); } + match->flags = GIT_ATTR_FNMATCH_ALLOWSPACE; + if (!(error = git_attr_fnmatch__parse( match, ignores->pool, context, &scan))) { diff --git a/tests-clar/status/ignore.c b/tests-clar/status/ignore.c index 369b25bda..0384306c1 100644 --- a/tests-clar/status/ignore.c +++ b/tests-clar/status/ignore.c @@ -131,3 +131,17 @@ void test_status_ignore__empty_repo_with_gitignore_rewrite(void) cl_assert(ignored); } +void test_status_ignore__ignore_pattern_contains_space(void) +{ + unsigned int flags; + const mode_t mode = 0777; + + g_repo = cl_git_sandbox_init("empty_standard_repo"); + cl_git_rewritefile("empty_standard_repo/.gitignore", "foo bar.txt\n"); + + cl_git_pass(git_futils_mkdir_r("empty_standard_repo/foo", NULL, mode)); + cl_git_mkfile("empty_standard_repo/foo/look-ma.txt", "I'm not going to be ignored!"); + + cl_git_pass(git_status_file(&flags, g_repo, "foo/look-ma.txt")); + cl_assert(flags == GIT_STATUS_WT_NEW); +} |
