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
4280fabb
Commit
4280fabb
authored
Oct 15, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3466 from libgit2/cmn/quick-parse-64
revwalk: make commit list use 64 bits for time
parents
8321596a
5ffdea6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
4 deletions
+39
-4
src/commit_list.c
+3
-3
src/commit_list.h
+1
-1
tests/revwalk/basic.c
+35
-0
No files found.
src/commit_list.c
View file @
4280fabb
...
...
@@ -110,7 +110,7 @@ static int commit_quick_parse(
const
uint8_t
*
buffer_end
=
buffer
+
buffer_len
;
const
uint8_t
*
parents_start
,
*
committer_start
;
int
i
,
parents
=
0
;
int
commit_time
;
int
64_t
commit_time
;
buffer
+=
strlen
(
"tree "
)
+
GIT_OID_HEXSZ
+
1
;
...
...
@@ -166,10 +166,10 @@ static int commit_quick_parse(
buffer
--
;
}
if
((
buffer
==
committer_start
)
||
(
git__strtol
32
(
&
commit_time
,
(
char
*
)(
buffer
+
1
),
NULL
,
10
)
<
0
))
if
((
buffer
==
committer_start
)
||
(
git__strtol
64
(
&
commit_time
,
(
char
*
)(
buffer
+
1
),
NULL
,
10
)
<
0
))
return
commit_error
(
commit
,
"cannot parse commit time"
);
commit
->
time
=
(
time_t
)
commit_time
;
commit
->
time
=
commit_time
;
commit
->
parsed
=
1
;
return
0
;
}
...
...
src/commit_list.h
View file @
4280fabb
...
...
@@ -22,7 +22,7 @@
typedef
struct
git_commit_list_node
{
git_oid
oid
;
uint32
_t
time
;
int64
_t
time
;
unsigned
int
seen
:
1
,
uninteresting
:
1
,
topo_delay
:
1
,
...
...
tests/revwalk/basic.c
View file @
4280fabb
...
...
@@ -437,3 +437,38 @@ void test_revwalk_basic__mimic_git_rev_list(void)
cl_git_fail_with
(
git_revwalk_next
(
&
oid
,
_walk
),
GIT_ITEROVER
);
}
void
test_revwalk_basic__big_timestamp
(
void
)
{
git_reference
*
head
;
git_commit
*
tip
;
git_signature
*
sig
;
git_tree
*
tree
;
git_oid
id
;
int
error
;
revwalk_basic_setup_walk
(
"testrepo.git"
);
cl_git_pass
(
git_repository_head
(
&
head
,
_repo
));
cl_git_pass
(
git_reference_peel
((
git_object
**
)
&
tip
,
head
,
GIT_OBJ_COMMIT
));
/* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */
cl_git_pass
(
git_signature_new
(
&
sig
,
"Joe"
,
"joe@example.com"
,
2399662595
,
0
));
cl_git_pass
(
git_commit_tree
(
&
tree
,
tip
));
cl_git_pass
(
git_commit_create
(
&
id
,
_repo
,
"HEAD"
,
sig
,
sig
,
NULL
,
"some message"
,
tree
,
1
,
&
tip
));
cl_git_pass
(
git_revwalk_push_head
(
_walk
));
while
((
error
=
git_revwalk_next
(
&
id
,
_walk
))
==
0
)
{
/* nothing */
}
cl_assert_equal_i
(
GIT_ITEROVER
,
error
);
git_tree_free
(
tree
);
git_commit_free
(
tip
);
git_reference_free
(
head
);
git_signature_free
(
sig
);
}
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