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
1b0d92b1
Commit
1b0d92b1
authored
Jun 06, 2011
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #238 from pegonma/git_oid_ncmp
Better name for git_oid_match
parents
fe79750b
c09093cc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
10 deletions
+10
-10
include/git2/oid.h
+1
-1
src/odb_loose.c
+1
-1
src/odb_pack.c
+2
-2
src/oid.c
+4
-4
src/oid.h
+2
-2
No files found.
include/git2/oid.h
View file @
1b0d92b1
...
@@ -144,7 +144,7 @@ GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
...
@@ -144,7 +144,7 @@ GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
* @param b second oid structure.
* @param b second oid structure.
* @return 0 in case of a match
* @return 0 in case of a match
*/
*/
GIT_EXTERN
(
int
)
gid_oid_
match
(
unsigned
int
len
,
git_oid
*
a
,
git_oid
*
b
);
GIT_EXTERN
(
int
)
gid_oid_
ncmp
(
unsigned
int
len
,
git_oid
*
a
,
git_oid
*
b
);
/**
/**
* OID Shortener object
* OID Shortener object
...
...
src/odb_loose.c
View file @
1b0d92b1
...
@@ -492,7 +492,7 @@ int fn_locate_object_short_oid(void *state, char *pathbuf) {
...
@@ -492,7 +492,7 @@ int fn_locate_object_short_oid(void *state, char *pathbuf) {
if
(
!
gitfo_exists
(
pathbuf
)
&&
gitfo_isdir
(
pathbuf
))
{
if
(
!
gitfo_exists
(
pathbuf
)
&&
gitfo_isdir
(
pathbuf
))
{
/* We are already in the directory matching the 2 first hex characters */
/* We are already in the directory matching the 2 first hex characters */
if
(
!
git_oid_
match
_hex
(
sstate
->
short_oid_len
-
2
,
sstate
->
short_oid
+
2
,
(
unsigned
char
*
)
pathbuf
+
sstate
->
dir_len
))
{
if
(
!
git_oid_
ncmp
_hex
(
sstate
->
short_oid_len
-
2
,
sstate
->
short_oid
+
2
,
(
unsigned
char
*
)
pathbuf
+
sstate
->
dir_len
))
{
if
(
!
sstate
->
found
)
{
if
(
!
sstate
->
found
)
{
sstate
->
res_oid
[
0
]
=
sstate
->
short_oid
[
0
];
sstate
->
res_oid
[
0
]
=
sstate
->
short_oid
[
0
];
sstate
->
res_oid
[
1
]
=
sstate
->
short_oid
[
1
];
sstate
->
res_oid
[
1
]
=
sstate
->
short_oid
[
1
];
...
...
src/odb_pack.c
View file @
1b0d92b1
...
@@ -1011,7 +1011,7 @@ static int pack_entry_find_offset(
...
@@ -1011,7 +1011,7 @@ static int pack_entry_find_offset(
if
(
pos
<
(
int
)
p
->
num_objects
)
{
if
(
pos
<
(
int
)
p
->
num_objects
)
{
current
=
index
+
pos
*
stride
;
current
=
index
+
pos
*
stride
;
if
(
!
git_oid_
match
_raw
(
len
,
short_oid
->
id
,
current
))
{
if
(
!
git_oid_
ncmp
_raw
(
len
,
short_oid
->
id
,
current
))
{
found
=
1
;
found
=
1
;
}
}
}
}
...
@@ -1021,7 +1021,7 @@ static int pack_entry_find_offset(
...
@@ -1021,7 +1021,7 @@ static int pack_entry_find_offset(
/* Check for ambiguousity */
/* Check for ambiguousity */
const
unsigned
char
*
next
=
current
+
stride
;
const
unsigned
char
*
next
=
current
+
stride
;
if
(
!
git_oid_
match
_raw
(
len
,
short_oid
->
id
,
next
))
{
if
(
!
git_oid_
ncmp
_raw
(
len
,
short_oid
->
id
,
next
))
{
found
=
2
;
found
=
2
;
}
}
}
}
...
...
src/oid.c
View file @
1b0d92b1
...
@@ -173,7 +173,7 @@ int git_oid_cmp(const git_oid *a, const git_oid *b)
...
@@ -173,7 +173,7 @@ int git_oid_cmp(const git_oid *a, const git_oid *b)
}
}
int
git_oid_
match
_raw
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
)
int
git_oid_
ncmp
_raw
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
)
{
{
do
{
do
{
if
(
*
a
!=
*
b
)
if
(
*
a
!=
*
b
)
...
@@ -188,14 +188,14 @@ int git_oid_match_raw(unsigned int len, const unsigned char *a, const unsigned c
...
@@ -188,14 +188,14 @@ int git_oid_match_raw(unsigned int len, const unsigned char *a, const unsigned c
return
0
;
return
0
;
}
}
int
git_oid_
match
_hex
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
)
int
git_oid_
ncmp
_hex
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
)
{
{
return
memcmp
(
a
,
b
,
len
);
return
memcmp
(
a
,
b
,
len
);
}
}
int
gid_oid_
match
(
unsigned
int
len
,
git_oid
*
a
,
git_oid
*
b
)
int
gid_oid_
ncmp
(
unsigned
int
len
,
git_oid
*
a
,
git_oid
*
b
)
{
{
return
git_oid_
match
_raw
(
len
,
a
->
id
,
b
->
id
);
return
git_oid_
ncmp
_raw
(
len
,
a
->
id
,
b
->
id
);
}
}
typedef
short
node_index
;
typedef
short
node_index
;
...
...
src/oid.h
View file @
1b0d92b1
...
@@ -6,12 +6,12 @@
...
@@ -6,12 +6,12 @@
* This can be useful for internal use.
* This can be useful for internal use.
* Return 0 if they match.
* Return 0 if they match.
*/
*/
int
git_oid_
match
_raw
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
);
int
git_oid_
ncmp
_raw
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
);
/**
/**
* Compare the first 'len' characters of two hex formatted oids.
* Compare the first 'len' characters of two hex formatted oids.
* Return 0 if they match.
* Return 0 if they match.
*/
*/
int
git_oid_
match
_hex
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
);
int
git_oid_
ncmp
_hex
(
unsigned
int
len
,
const
unsigned
char
*
a
,
const
unsigned
char
*
b
);
#endif
#endif
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