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
8961f5b9
Commit
8961f5b9
authored
Apr 08, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
describe: support sha256
parent
e01df928
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
src/libgit2/describe.c
+10
-7
No files found.
src/libgit2/describe.c
View file @
8961f5b9
...
...
@@ -363,12 +363,15 @@ static int find_unique_abbrev_size(
size_t
size
=
abbreviated_size
;
git_odb
*
odb
;
git_oid
dummy
;
size_t
hexsize
;
int
error
;
if
((
error
=
git_repository_odb__weakptr
(
&
odb
,
repo
))
<
0
)
return
error
;
while
(
size
<
GIT_OID_SHA1_HEXSIZE
)
{
hexsize
=
git_oid_hexsize
(
repo
->
oid_type
);
while
(
size
<
hexsize
)
{
if
((
error
=
git_odb_exists_prefix
(
&
dummy
,
odb
,
oid_in
,
size
))
==
0
)
{
*
out
=
(
int
)
size
;
return
0
;
...
...
@@ -383,7 +386,7 @@ static int find_unique_abbrev_size(
}
/* If we didn't find any shorter prefix, we have to do the whole thing */
*
out
=
GIT_OID_SHA1_HEXSIZE
;
*
out
=
(
int
)
hexsize
;
return
0
;
}
...
...
@@ -397,7 +400,7 @@ static int show_suffix(
{
int
error
,
size
=
0
;
char
hex_oid
[
GIT_OID_
SHA1
_HEXSIZE
];
char
hex_oid
[
GIT_OID_
MAX
_HEXSIZE
];
if
((
error
=
find_unique_abbrev_size
(
&
size
,
repo
,
id
,
abbrev_size
))
<
0
)
return
error
;
...
...
@@ -414,7 +417,7 @@ static int show_suffix(
#define MAX_CANDIDATES_TAGS FLAG_BITS - 1
static
int
describe_not_found
(
const
git_oid
*
oid
,
const
char
*
message_format
)
{
char
oid_str
[
GIT_OID_
SHA1
_HEXSIZE
+
1
];
char
oid_str
[
GIT_OID_
MAX
_HEXSIZE
+
1
];
git_oid_tostr
(
oid_str
,
sizeof
(
oid_str
),
oid
);
git_error_set
(
GIT_ERROR_DESCRIBE
,
message_format
,
oid_str
);
...
...
@@ -525,7 +528,7 @@ static int describe(
if
(
annotated_cnt
&&
(
git_pqueue_size
(
&
list
)
==
0
))
{
/*
if (debug) {
char oid_str[GIT_OID_
SHA1
_HEXSIZE + 1];
char oid_str[GIT_OID_
MAX
_HEXSIZE + 1];
git_oid_tostr(oid_str, sizeof(oid_str), &c->oid);
fprintf(stderr, "finished search at %s\n", oid_str);
...
...
@@ -592,7 +595,7 @@ static int describe(
"head", "lightweight", "annotated",
};
char oid_str[GIT_OID_
SHA1
_HEXSIZE + 1];
char oid_str[GIT_OID_
MAX
_HEXSIZE + 1];
if (debug) {
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
...
...
@@ -816,7 +819,7 @@ static int git_describe__format(
/* If we didn't find *any* tags, we fall back to the commit's id */
if
(
result
->
fallback_to_id
)
{
char
hex_oid
[
GIT_OID_
SHA1
_HEXSIZE
+
1
]
=
{
0
};
char
hex_oid
[
GIT_OID_
MAX
_HEXSIZE
+
1
]
=
{
0
};
int
size
=
0
;
if
((
error
=
find_unique_abbrev_size
(
...
...
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