aboutsummaryrefslogtreecommitdiff
path: root/t/t7501-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-07-22 13:03:29 -0700
committerJunio C Hamano <gitster@pobox.com>2012-07-22 13:03:29 -0700
commitf5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3 (patch)
treede02b5b5b4739f1537c47400ad6d7129efe3bfb7 /t/t7501-commit.sh
parent1cd2913960f752508c3f529dbccd359ed79a1a9f (diff)
parentea2d4ed35902ce15959965ab86d80527731a177c (diff)
downloadgit-f5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3.tar.gz
git-f5a8400960f05ed6489f7e5be0c7aa06c7e4a9e3.tar.xz
Merge branch 'jk/maint-commit-amend-only-no-paths' into maint
"git commit --amend --only --" was meant to allow "Clever" people to rewrite the commit message without making any change even when they have already changes for the next commit added to their index, but it never worked as advertised since it was introduced in 1.3.0 era. * jk/maint-commit-amend-only-no-paths: commit: fix "--amend --only" with no pathspec
Diffstat (limited to 't/t7501-commit.sh')
-rwxr-xr-xt/t7501-commit.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 676da85b5..3f364a20e 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -108,6 +108,16 @@ test_expect_success 'amend commit' '
EDITOR=./editor git commit --amend
'
+test_expect_success 'amend --only ignores staged contents' '
+ cp file file.expect &&
+ echo changed >file &&
+ git add file &&
+ git commit --no-edit --amend --only &&
+ git cat-file blob HEAD:file >file.actual &&
+ test_cmp file.expect file.actual &&
+ git diff --exit-code
+'
+
test_expect_success 'set up editor' '
cat >editor <<-\EOF &&
#!/bin/sh