Merge ../gitk
[gitweb.git] / t / t7501-commit.sh
index 19c4b2c5566dcd6a88b8b557d4d597079df21b4e..d1a415a12624f4a116a9001bad48c34420671280 100755 (executable)
@@ -4,7 +4,7 @@
 #
 
 # FIXME: Test the various index usages, -i and -o, test reflog,
-# signoff, hooks
+# signoff
 
 test_description='git-commit'
 . ./test-lib.sh
@@ -310,4 +310,21 @@ test_expect_success 'same tree (merge and amend merge)' '
 
 '
 
+test_expect_success 'amend using the message from another commit' '
+
+       git reset --hard &&
+       test_tick &&
+       git commit --allow-empty -m "old commit" &&
+       old=$(git rev-parse --verify HEAD) &&
+       test_tick &&
+       git commit --allow-empty -m "new commit" &&
+       new=$(git rev-parse --verify HEAD) &&
+       test_tick &&
+       git commit --allow-empty --amend -C "$old" &&
+       git show --pretty="format:%ad %s" "$old" >expected &&
+       git show --pretty="format:%ad %s" HEAD >actual &&
+       diff -u expected actual
+
+'
+
 test_done