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
23594c1d
Commit
23594c1d
authored
Jan 09, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add git_path_icmp to case-insensitive path cmp
This adds git_path_icmp to complement git_path_cmp.
parent
851ad650
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
src/path.c
+24
-0
src/path.h
+6
-1
No files found.
src/path.c
View file @
23594c1d
...
...
@@ -701,6 +701,30 @@ int git_path_cmp(
return
(
c1
<
c2
)
?
-
1
:
(
c1
>
c2
)
?
1
:
0
;
}
int
git_path_icmp
(
const
char
*
name1
,
size_t
len1
,
int
isdir1
,
const
char
*
name2
,
size_t
len2
,
int
isdir2
)
{
unsigned
char
c1
,
c2
;
size_t
len
=
len1
<
len2
?
len1
:
len2
;
int
cmp
;
cmp
=
strncasecmp
(
name1
,
name2
,
len
);
if
(
cmp
)
return
cmp
;
c1
=
name1
[
len
];
c2
=
name2
[
len
];
if
(
c1
==
'\0'
&&
isdir1
)
c1
=
'/'
;
if
(
c2
==
'\0'
&&
isdir2
)
c2
=
'/'
;
return
(
c1
<
c2
)
?
-
1
:
(
c1
>
c2
)
?
1
:
0
;
}
int
git_path_direach
(
git_buf
*
path
,
int
(
*
fn
)(
void
*
,
git_buf
*
),
...
...
src/path.h
View file @
23594c1d
...
...
@@ -261,12 +261,17 @@ extern int git_path_direach(
void
*
state
);
/**
* Sort function to order two paths
.
* Sort function to order two paths
*/
extern
int
git_path_cmp
(
const
char
*
name1
,
size_t
len1
,
int
isdir1
,
const
char
*
name2
,
size_t
len2
,
int
isdir2
);
/** Path sort function that is case insensitive */
extern
int
git_path_icmp
(
const
char
*
name1
,
size_t
len1
,
int
isdir1
,
const
char
*
name2
,
size_t
len2
,
int
isdir2
);
/**
* Invoke callback up path directory by directory until the ceiling is
* reached (inclusive of a final call at the root_path).
...
...
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