From 5a503fffbc01037c8e6e6bb2f755f7d62d09faf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 8 Apr 2015 23:42:36 +0200 Subject: [PATCH] revwalk: add failing test for hiding and then pushing a commit When we hide a commit which we later push into the revwalk, we do not handle this well and return commits which we should not. --- tests/revwalk/basic.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c index 4ae952775..7e50452c9 100644 --- a/tests/revwalk/basic.c +++ b/tests/revwalk/basic.c @@ -314,6 +314,23 @@ void test_revwalk_basic__disallow_non_commit(void) cl_git_fail(git_revwalk_push(_walk, &oid)); } +void test_revwalk_basic__hide_then_push(void) +{ + git_oid oid; + int i = 0; + + revwalk_basic_setup_walk(NULL); + cl_git_pass(git_oid_fromstr(&oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644")); + + cl_git_pass(git_revwalk_hide(_walk, &oid)); + cl_git_pass(git_revwalk_push(_walk, &oid)); + + while (git_revwalk_next(&oid, _walk) == 0) + i++; + + cl_assert_equal_i(i, 0); +} + void test_revwalk_basic__push_range(void) { revwalk_basic_setup_walk(NULL);