revert: add t3513 for submodule updates
Test that the revert command updates the work tree as expected (for submodule changes which don't result in conflicts). Add a helper function to first revert the checked out target commit to make the last revert produce the to-be-tested work tree. Set the KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT and KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR switches to document that revert has the similar failures. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jens Lehmann committed
Jun 19, 2014 at 22:12 UTC
1621c99c79875d6537edc59b6c2b4c2038a97b20
1 file changed
+32
t/t3513-revert-submodule.sh
new
+32
@@ -0,0 +1,32 @@
1
+#!/bin/sh
2
+
3
+test_description='revert can handle submodules'
4
+
5
+. ./test-lib.sh
6
+. "$TEST_DIRECTORY"/lib-submodule-update.sh
7
+
8
+# Create a revert that moves from HEAD (including any test modifications to
9
+# the work tree) to $1 by first checking out $1 and reverting it. Reverting
10
+# the revert is the transition we test for. We tar the current work tree
11
+# first so we can restore the work tree test setup after doing the checkout
12
+# and revert. We test here that the restored work tree content is identical
13
+# to that at the beginning. The last revert is then tested by the framework.
14
+git_revert () {
15
+ git status -su >expect &&
16
+ ls -1pR * >>expect &&
17
+ tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
18
+ git checkout "$1" &&
19
+ git revert HEAD &&
20
+ rm -rf * &&
21
+ tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
22
+ git status -su >actual &&
23
+ ls -1pR * >>actual &&
24
+ test_cmp expect actual &&
25
+ git revert HEAD
26
+}
27
+
28
+KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
29
+KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
30
+test_submodule_switch "git_revert"
31
+
32
+test_done