Merge branch 'jk/maint-commit-amend-only-no-paths' into maint
[gitweb.git] / t / t7501-commit.sh
index 676da85b52cfd635dc2e08385b568260341f4d04..3f364a20e855f59e685dc424f51d93d7d7d8d7b9 100755 (executable)
@@ -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