Skip to content

Commit 8589a74

Browse files
committed
Merge branch 'tr/test-commit-only-on-orphan' into maint
* tr/test-commit-only-on-orphan: Test 'commit --only' after 'checkout --orphan'
2 parents 509152d + f0c7320 commit 8589a74

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

t/t7501-commit.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,4 +524,17 @@ test_expect_success 'commit a file whose name is a dash' '
524524
test_i18ngrep " changed, 5 insertions" output
525525
'
526526

527+
test_expect_success '--only works on to-be-born branch' '
528+
# This test relies on having something in the index, as it
529+
# would not otherwise actually prove much. So check this.
530+
test -n "$(git ls-files)" &&
531+
git checkout --orphan orphan &&
532+
echo foo >newfile &&
533+
git add newfile &&
534+
git commit --only newfile -m"--only on unborn branch" &&
535+
echo newfile >expected &&
536+
git ls-tree -r --name-only HEAD >actual &&
537+
test_cmp expected actual
538+
'
539+
527540
test_done

0 commit comments

Comments
 (0)