Commit 80779ea8 by Vicent Martí

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"
parents e0b110ed 9939e602
...@@ -28,6 +28,8 @@ static int parse_ignore_file( ...@@ -28,6 +28,8 @@ static int parse_ignore_file(
GITERR_CHECK_ALLOC(match); GITERR_CHECK_ALLOC(match);
} }
match->flags = GIT_ATTR_FNMATCH_ALLOWSPACE;
if (!(error = git_attr_fnmatch__parse( if (!(error = git_attr_fnmatch__parse(
match, ignores->pool, context, &scan))) match, ignores->pool, context, &scan)))
{ {
......
...@@ -131,3 +131,17 @@ void test_status_ignore__empty_repo_with_gitignore_rewrite(void) ...@@ -131,3 +131,17 @@ void test_status_ignore__empty_repo_with_gitignore_rewrite(void)
cl_assert(ignored); 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment