usage.c: drop set_error_handle()
[git/debian.git] / t / t7516-commit-races.sh
blobf2ce14e9071c0a3b071f53186c2d311103883443
1 #!/bin/sh
3 test_description='git commit races'
4 . ./test-lib.sh
6 test_expect_success 'race to create orphan commit' '
7 write_script hare-editor <<-\EOF &&
8 git commit --allow-empty -m hare
9 EOF
10 test_must_fail env EDITOR=./hare-editor git commit --allow-empty -m tortoise -e &&
11 git show -s --pretty=format:%s >subject &&
12 grep hare subject &&
13 test -z "$(git show -s --pretty=format:%P)"
16 test_expect_success 'race to create non-orphan commit' '
17 write_script airplane-editor <<-\EOF &&
18 git commit --allow-empty -m airplane
19 EOF
20 git checkout --orphan branch &&
21 git commit --allow-empty -m base &&
22 git rev-parse HEAD >base &&
23 test_must_fail env EDITOR=./airplane-editor git commit --allow-empty -m ship -e &&
24 git show -s --pretty=format:%s >subject &&
25 grep airplane subject &&
26 git rev-parse HEAD^ >parent &&
27 test_cmp base parent
30 test_done