aboutsummaryrefslogtreecommitdiff
path: root/t/t0062-revision-walking.sh
diff options
context:
space:
mode:
authorHeiko Voigt <hvoigt@hvoigt.net>2012-03-29 09:21:21 +0200
committerJunio C Hamano <gitster@pobox.com>2012-03-30 08:57:49 -0700
commitbcc0a3ea38a42a64878e11c5244ef2fcc967e05d (patch)
tree5ca0d025050a6b81fce75af772de37715a7c7ed2 /t/t0062-revision-walking.sh
parent6f5e880c68099b185e60b2492c75e506e16d8292 (diff)
downloadgit-bcc0a3ea38a42a64878e11c5244ef2fcc967e05d.tar.gz
git-bcc0a3ea38a42a64878e11c5244ef2fcc967e05d.tar.xz
Teach revision walking machinery to walk multiple times sequencially
Previously it was not possible to iterate revisions twice using the revision walking api. We add a reset_revision_walk() which clears the used flags. This allows us to do multiple sequencial revision walks. We add the appropriate calls to the existing submodule machinery doing revision walks. This is done to avoid surprises if future code wants to call these functions more than once during the processes lifetime. Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0062-revision-walking.sh')
-rwxr-xr-xt/t0062-revision-walking.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/t0062-revision-walking.sh b/t/t0062-revision-walking.sh
new file mode 100755
index 000000000..3d98eb847
--- /dev/null
+++ b/t/t0062-revision-walking.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Heiko Voigt
+#
+
+test_description='Test revision walking api'
+
+. ./test-lib.sh
+
+cat >run_twice_expected <<-EOF
+1st
+ > add b
+ > add a
+2nd
+ > add b
+ > add a
+EOF
+
+test_expect_success 'setup' '
+ echo a > a &&
+ git add a &&
+ git commit -m "add a" &&
+ echo b > b &&
+ git add b &&
+ git commit -m "add b"
+'
+
+test_expect_success 'revision walking can be done twice' '
+ test-revision-walking run-twice > run_twice_actual
+ test_cmp run_twice_expected run_twice_actual
+'
+
+test_done