Merge branch 'jh/note-trees-record-blobs'
[gitweb.git] / t / t7501-commit.sh
index 195e7477d883f39d51f5740b5b309a489dd92d3d..94eec83b37f38699af91b3808051515f267f3a5f 100755 (executable)
@@ -53,10 +53,11 @@ test_expect_success PERL 'can use paths with --interactive' '
 '
 
 test_expect_success 'using invalid commit with -C' '
-       test_must_fail git commit -C bogus
+       test_must_fail git commit --allow-empty -C bogus
 '
 
 test_expect_success 'nothing to commit' '
+       git reset --hard &&
        test_must_fail git commit -m initial
 '
 
@@ -524,4 +525,17 @@ test_expect_success 'commit a file whose name is a dash' '
        test_i18ngrep " changed, 5 insertions" output
 '
 
+test_expect_success '--only works on to-be-born branch' '
+       # This test relies on having something in the index, as it
+       # would not otherwise actually prove much.  So check this.
+       test -n "$(git ls-files)" &&
+       git checkout --orphan orphan &&
+       echo foo >newfile &&
+       git add newfile &&
+       git commit --only newfile -m"--only on unborn branch" &&
+       echo newfile >expected &&
+       git ls-tree -r --name-only HEAD >actual &&
+       test_cmp expected actual
+'
+
 test_done