Merge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11
[gitweb.git] / t / t7501-commit.sh
index b20ca0eace9dd8f9a11227ebfb932e0446278ea1..195e7477d883f39d51f5740b5b309a489dd92d3d 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
@@ -138,6 +148,21 @@ test_expect_success '--amend --edit' '
        test_cmp expect msg
 '
 
+test_expect_success '--amend --edit of empty message' '
+       cat >replace <<-\EOF &&
+       #!/bin/sh
+       echo "amended" >"$1"
+       EOF
+       chmod 755 replace &&
+       git commit --allow-empty --allow-empty-message -m "" &&
+       echo more bongo >file &&
+       git add file &&
+       EDITOR=./replace git commit --edit --amend &&
+       git diff-tree -s --format=%s HEAD >msg &&
+       ./replace expect &&
+       test_cmp expect msg
+'
+
 test_expect_success '-m --edit' '
        echo amended >expect &&
        git commit --allow-empty -m buffer &&
@@ -487,4 +512,16 @@ test_expect_success 'amend can copy notes' '
 
 '
 
+test_expect_success 'commit a file whose name is a dash' '
+       git reset --hard &&
+       for i in 1 2 3 4 5
+       do
+               echo $i
+       done >./- &&
+       git add ./- &&
+       test_tick &&
+       git commit -m "add dash" >output </dev/null &&
+       test_i18ngrep " changed, 5 insertions" output
+'
+
 test_done