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
e5e71f5e
Commit
e5e71f5e
authored
Jul 18, 2012
by
yorah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more test coverage to match default git behavior for files containing brackets
parent
151446ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
+17
-1
tests-clar/status/worktree.c
+17
-1
No files found.
tests-clar/status/worktree.c
View file @
e5e71f5e
...
@@ -523,8 +523,10 @@ void test_status_worktree__bracket_in_filename(void)
...
@@ -523,8 +523,10 @@ void test_status_worktree__bracket_in_filename(void)
git_index
*
index
;
git_index
*
index
;
status_entry_single
result
;
status_entry_single
result
;
unsigned
int
status_flags
;
unsigned
int
status_flags
;
int
error
;
#define FILE_WITH_BRACKET "LICENSE[1].md"
#define FILE_WITH_BRACKET "LICENSE[1].md"
#define FILE_WITHOUT_BRACKET "LICENSE1.md"
cl_git_pass
(
git_repository_init
(
&
repo
,
"with_bracket"
,
0
));
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
"
);
cl_git_mkfile
(
"with_bracket/"
FILE_WITH_BRACKET
,
"I have a bracket in my name
\n
"
);
...
@@ -536,7 +538,7 @@ void test_status_worktree__bracket_in_filename(void)
...
@@ -536,7 +538,7 @@ void test_status_worktree__bracket_in_filename(void)
cl_assert_equal_i
(
1
,
result
.
count
);
cl_assert_equal_i
(
1
,
result
.
count
);
cl_assert
(
result
.
status
==
GIT_STATUS_WT_NEW
);
cl_assert
(
result
.
status
==
GIT_STATUS_WT_NEW
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
"LICENSE[1].md"
));
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_WT_NEW
);
cl_assert
(
status_flags
==
GIT_STATUS_WT_NEW
);
/* ignore the file */
/* ignore the file */
...
@@ -577,6 +579,20 @@ void test_status_worktree__bracket_in_filename(void)
...
@@ -577,6 +579,20 @@ void test_status_worktree__bracket_in_filename(void)
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_INDEX_NEW
);
cl_assert
(
status_flags
==
GIT_STATUS_INDEX_NEW
);
/* Create file without bracket */
cl_git_mkfile
(
"with_bracket/"
FILE_WITHOUT_BRACKET
,
"I have no bracket in my name!
\n
"
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
FILE_WITHOUT_BRACKET
));
cl_assert
(
status_flags
==
GIT_STATUS_WT_NEW
);
cl_git_pass
(
git_status_file
(
&
status_flags
,
repo
,
"LICENSE
\\
[1
\\
].md"
));
cl_assert
(
status_flags
==
GIT_STATUS_INDEX_NEW
);
error
=
git_status_file
(
&
status_flags
,
repo
,
FILE_WITH_BRACKET
);
cl_git_fail
(
error
);
cl_assert
(
error
==
GIT_EAMBIGUOUS
);
git_index_free
(
index
);
git_index_free
(
index
);
git_repository_free
(
repo
);
git_repository_free
(
repo
);
}
}
...
...
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