diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-10-14 16:49:01 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-10-14 16:54:13 +0200 |
commit | 5ffdea6f65bb105c17a1c4730d51732e3391bf63 (patch) | |
tree | 84076a2c3b345128dd3b31db2fdcf443d47fdb62 /tests/revwalk/basic.c | |
parent | d8dc2b8f54cdf7d707c6a552175dc0d619dc230e (diff) | |
download | libgit2-cmn/quick-parse-64.tar.gz |
revwalk: make commit list use 64 bits for timecmn/quick-parse-64
We moved the "main" parsing to use 64 bits for the timestamp, but the
quick parsing for the revwalk did not. This means that for large
timestamps we fail to parse the time and thus the walk.
Move this parser to use 64 bits as well.
Diffstat (limited to 'tests/revwalk/basic.c')
-rw-r--r-- | tests/revwalk/basic.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c index 7e50452c9..d8236ce72 100644 --- a/tests/revwalk/basic.c +++ b/tests/revwalk/basic.c @@ -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); + +} |