Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
151446ca
Commit
151446ca
authored
Jul 03, 2012
by
aroben
Committed by
yorah
Jul 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for getting status of files containing brackets
parent
02a0d651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
tests-clar/status/worktree.c
+63
-0
No files found.
tests-clar/status/worktree.c
View file @
151446ca
...
...
@@ -517,6 +517,69 @@ void test_status_worktree__status_file_with_clean_index_and_empty_workdir(void)
cl_git_pass
(
p_unlink
(
"my-index"
));
}
void
test_status_worktree__bracket_in_filename
(
void
)
{
git_repository
*
repo
;
git_index
*
index
;
status_entry_single
result
;
unsigned
int
status_flags
;
#define FILE_WITH_BRACKET "LICENSE[1].md"
cl_git_pass
(
git_repository_init
(
&
repo
,
"with_bracket"
,
0
));
cl_git_mkfile
(
"with_bracket/"
FILE_WITH_BRACKET
,
"I have a bracket in my name
\n
"
);
/* file is new to working directory */
memset
(
&
result
,
0
,
sizeof
(
result
));
cl_git_pass
(
git_status_foreach
(
repo
,
cb_status__single
,
&
result
));
cl_assert_equal_i
(
1
,
result
.
count
);
cl_assert
(
result
.
status
==
GIT_STATUS_WT_NEW
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
"LICENSE[1].md"
));
cl_assert
(
status_flags
==
GIT_STATUS_WT_NEW
);
/* ignore the file */
cl_git_rewritefile
(
"with_bracket/.gitignore"
,
"*.md
\n
.gitignore
\n
"
);
memset
(
&
result
,
0
,
sizeof
(
result
));
cl_git_pass
(
git_status_foreach
(
repo
,
cb_status__single
,
&
result
));
cl_assert_equal_i
(
2
,
result
.
count
);
cl_assert
(
result
.
status
==
GIT_STATUS_IGNORED
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_IGNORED
);
/* don't ignore the file */
cl_git_rewritefile
(
"with_bracket/.gitignore"
,
".gitignore
\n
"
);
memset
(
&
result
,
0
,
sizeof
(
result
));
cl_git_pass
(
git_status_foreach
(
repo
,
cb_status__single
,
&
result
));
cl_assert_equal_i
(
2
,
result
.
count
);
cl_assert
(
result
.
status
==
GIT_STATUS_WT_NEW
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_WT_NEW
);
/* add the file to the index */
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
cl_git_pass
(
git_index_add
(
index
,
FILE_WITH_BRACKET
,
0
));
cl_git_pass
(
git_index_write
(
index
));
memset
(
&
result
,
0
,
sizeof
(
result
));
cl_git_pass
(
git_status_foreach
(
repo
,
cb_status__single
,
&
result
));
cl_assert_equal_i
(
2
,
result
.
count
);
cl_assert
(
result
.
status
==
GIT_STATUS_INDEX_NEW
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_INDEX_NEW
);
git_index_free
(
index
);
git_repository_free
(
repo
);
}
void
test_status_worktree__space_in_filename
(
void
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment