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
a3bfd284
Commit
a3bfd284
authored
Aug 31, 2022
by
Yuang Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GIT_OID_SHA1_HEXSIZE
parent
7c2b1f45
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
13 deletions
+13
-13
src/libgit2/grafts.c
+4
-4
src/libgit2/repository.c
+1
-1
src/libgit2/transports/smart_pkt.c
+8
-8
No files found.
src/libgit2/grafts.c
View file @
a3bfd284
...
...
@@ -133,22 +133,22 @@ int git_grafts_parse(git_grafts *grafts, const char *content, size_t contentlen)
const
char
*
line_start
=
parser
.
line
,
*
line_end
=
parser
.
line
+
parser
.
line_len
;
git_oid
graft_oid
;
if
((
error
=
git_oid_fromstrn
(
&
graft_oid
,
line_start
,
GIT_OID_
HEXSZ
))
<
0
)
{
if
((
error
=
git_oid_fromstrn
(
&
graft_oid
,
line_start
,
GIT_OID_
SHA1_HEXSIZE
))
<
0
)
{
git_error_set
(
GIT_ERROR_GRAFTS
,
"invalid graft OID at line %"
PRIuZ
,
parser
.
line_num
);
goto
error
;
}
line_start
+=
GIT_OID_
HEXSZ
;
line_start
+=
GIT_OID_
SHA1_HEXSIZE
;
while
(
line_start
<
line_end
&&
*
line_start
==
' '
)
{
git_oid
*
id
=
git_array_alloc
(
parents
);
GIT_ERROR_CHECK_ALLOC
(
id
);
if
((
error
=
git_oid_fromstrn
(
id
,
++
line_start
,
GIT_OID_
HEXSZ
))
<
0
)
{
if
((
error
=
git_oid_fromstrn
(
id
,
++
line_start
,
GIT_OID_
SHA1_HEXSIZE
))
<
0
)
{
git_error_set
(
GIT_ERROR_GRAFTS
,
"invalid parent OID at line %"
PRIuZ
,
parser
.
line_num
);
goto
error
;
}
line_start
+=
GIT_OID_
HEXSZ
;
line_start
+=
GIT_OID_
SHA1_HEXSIZE
;
}
if
((
error
=
git_grafts_add
(
grafts
,
&
graft_oid
,
parents
))
<
0
)
...
...
src/libgit2/repository.c
View file @
a3bfd284
...
...
@@ -3372,7 +3372,7 @@ int git_repository__shallow_roots_write(git_repository *repo, git_array_oid_t ro
goto
on_error
;
git_array_foreach
(
roots
,
idx
,
oid
)
{
git_filebuf_write
(
&
file
,
git_oid_tostr_s
(
oid
),
GIT_OID_
HEXSZ
);
git_filebuf_write
(
&
file
,
git_oid_tostr_s
(
oid
),
GIT_OID_
SHA1_HEXSIZE
);
git_filebuf_write
(
&
file
,
"
\n
"
,
1
);
}
...
...
src/libgit2/transports/smart_pkt.c
View file @
a3bfd284
...
...
@@ -377,10 +377,10 @@ static int shallow_pkt(git_pkt **out, const char *line, size_t len)
line
+=
7
;
len
-=
7
;
if
(
len
>=
GIT_OID_
HEXSZ
)
{
if
(
len
>=
GIT_OID_
SHA1_HEXSIZE
)
{
git_oid_fromstr
(
&
pkt
->
oid
,
line
+
1
);
line
+=
GIT_OID_
HEXSZ
+
1
;
len
-=
GIT_OID_
HEXSZ
+
1
;
line
+=
GIT_OID_
SHA1_HEXSIZE
+
1
;
len
-=
GIT_OID_
SHA1_HEXSIZE
+
1
;
}
*
out
=
(
git_pkt
*
)
pkt
;
...
...
@@ -399,10 +399,10 @@ static int unshallow_pkt(git_pkt **out, const char *line, size_t len)
line
+=
9
;
len
-=
9
;
if
(
len
>=
GIT_OID_
HEXSZ
)
{
if
(
len
>=
GIT_OID_
SHA1_HEXSIZE
)
{
git_oid_fromstr
(
&
pkt
->
oid
,
line
+
1
);
line
+=
GIT_OID_
HEXSZ
+
1
;
len
-=
GIT_OID_
HEXSZ
+
1
;
line
+=
GIT_OID_
SHA1_HEXSIZE
+
1
;
len
-=
GIT_OID_
SHA1_HEXSIZE
+
1
;
}
*
out
=
(
git_pkt
*
)
pkt
;
...
...
@@ -674,12 +674,12 @@ int git_pkt_buffer_wants(
/* Tell the server about our shallow objects */
for
(
i
=
0
;
i
<
git_shallowarray_count
(
wants
->
shallow_roots
);
i
++
)
{
char
oid
[
GIT_OID_
HEXSZ
];
char
oid
[
GIT_OID_
SHA1_HEXSIZE
];
git_str
shallow_buf
=
GIT_STR_INIT
;
git_oid_fmt
(
oid
,
git_shallowarray_get
(
wants
->
shallow_roots
,
i
));
git_str_puts
(
&
shallow_buf
,
"shallow "
);
git_str_put
(
&
shallow_buf
,
oid
,
GIT_OID_
HEXSZ
);
git_str_put
(
&
shallow_buf
,
oid
,
GIT_OID_
SHA1_HEXSIZE
);
git_str_putc
(
&
shallow_buf
,
'\n'
);
git_str_printf
(
buf
,
"%04x%s"
,
(
unsigned
int
)
git_str_len
(
&
shallow_buf
)
+
4
,
git_str_cstr
(
&
shallow_buf
));
...
...
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