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
ffbc689c
Commit
ffbc689c
authored
Jul 18, 2012
by
yorah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix getting status of files containing brackets
parent
e5e71f5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
src/diff.c
+16
-7
src/status.c
+4
-2
No files found.
src/diff.c
View file @
ffbc689c
...
...
@@ -20,14 +20,21 @@ static char *diff_prefix_from_pathspec(const git_strarray *pathspec)
return
NULL
;
/* diff prefix will only be leading non-wildcards */
for
(
scan
=
prefix
.
ptr
;
*
scan
&&
!
git__iswildcard
(
*
scan
);
++
scan
);
for
(
scan
=
prefix
.
ptr
;
*
scan
;
++
scan
)
{
if
(
git__iswildcard
(
*
scan
)
&&
(
scan
==
prefix
.
ptr
||
(
*
(
scan
-
1
)
!=
'\\'
)))
break
;
}
git_buf_truncate
(
&
prefix
,
scan
-
prefix
.
ptr
);
if
(
prefix
.
size
>
0
)
return
git_buf_detach
(
&
prefix
);
if
(
prefix
.
size
<=
0
)
{
git_buf_free
(
&
prefix
);
return
NULL
;
}
git_buf_free
(
&
prefix
);
return
NULL
;
git_buf_unescape
(
&
prefix
);
return
git_buf_detach
(
&
prefix
);
}
static
bool
diff_pathspec_is_interesting
(
const
git_strarray
*
pathspec
)
...
...
@@ -54,7 +61,10 @@ static bool diff_path_matches_pathspec(git_diff_list *diff, const char *path)
return
true
;
git_vector_foreach
(
&
diff
->
pathspec
,
i
,
match
)
{
int
result
=
p_fnmatch
(
match
->
pattern
,
path
,
0
);
int
result
=
strcmp
(
match
->
pattern
,
path
);
if
(
result
!=
0
)
result
=
p_fnmatch
(
match
->
pattern
,
path
,
0
);
/* if we didn't match, look for exact dirname prefix match */
if
(
result
==
FNM_NOMATCH
&&
...
...
@@ -826,4 +836,3 @@ int git_diff_merge(
return
error
;
}
src/status.c
View file @
ffbc689c
...
...
@@ -176,10 +176,12 @@ static int get_one_status(const char *path, unsigned int status, void *data)
sfi
->
count
++
;
sfi
->
status
=
status
;
if
(
sfi
->
count
>
1
||
strcmp
(
sfi
->
expected
,
path
)
!=
0
)
{
if
(
sfi
->
count
>
1
||
(
strcmp
(
sfi
->
expected
,
path
)
!=
0
&&
p_fnmatch
(
sfi
->
expected
,
path
,
0
)
!=
0
))
{
giterr_set
(
GITERR_INVALID
,
"Ambiguous path '%s' given to git_status_file"
,
sfi
->
expected
);
return
-
1
;
return
GIT_EAMBIGUOUS
;
}
return
0
;
...
...
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