summaryrefslogtreecommitdiff
path: root/tests-clar/revwalk
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-02-27 22:22:45 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-02-27 22:26:37 +0100
commitf7367993cba7b6a3c72da0b4a09c0ae88c7446c0 (patch)
tree119fbaa24c00c42300d6c424c7c0094d9638e1ea /tests-clar/revwalk
parentf0fa1c1a73f5a19a9799c0f8b90dcd533154cb3a (diff)
downloadlibgit2-f7367993cba7b6a3c72da0b4a09c0ae88c7446c0.tar.gz
revwalk: add convenience function to push/hide HEAD
It's not unusual to want the walker to act on HEAD, so add a convencience function for the case that the user doesn't already have a resolved HEAD reference.
Diffstat (limited to 'tests-clar/revwalk')
-rw-r--r--tests-clar/revwalk/basic.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests-clar/revwalk/basic.c b/tests-clar/revwalk/basic.c
index f013945ff..fff93ec93 100644
--- a/tests-clar/revwalk/basic.c
+++ b/tests-clar/revwalk/basic.c
@@ -132,3 +132,18 @@ void test_revwalk_basic__glob_heads(void)
/* git log --branches --oneline | wc -l => 13 */
cl_assert(i == 13);
}
+
+void test_revwalk_basic__push_head(void)
+{
+ int i = 0;
+ git_oid oid;
+
+ cl_git_pass(git_revwalk_push_head(_walk));
+
+ while (git_revwalk_next(&oid, _walk) == GIT_SUCCESS) {
+ i++;
+ }
+
+ /* git log HEAD --oneline | wc -l => 7 */
+ cl_assert(i == 7);
+}