Commit 5a503fffbc01037c8e6e6bb2f755f7d62d09faf6

Carlos Martín Nieto 2015-04-08T23:42:36

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.

diff --git a/tests/revwalk/basic.c b/tests/revwalk/basic.c
index 4ae9527..7e50452 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);