]> git.ipfire.org Git - thirdparty/git.git/blame - t/t7516-commit-races.sh
The seventh batch
[thirdparty/git.git] / t / t7516-commit-races.sh
CommitLineData
a908a31c
MH
1#!/bin/sh
2
3test_description='git commit races'
20debfb2
TB
4
5TEST_PASSES_SANITIZE_LEAK=true
a908a31c
MH
6. ./test-lib.sh
7
a933c23e 8test_expect_success 'race to create orphan commit' '
a908a31c
MH
9 write_script hare-editor <<-\EOF &&
10 git commit --allow-empty -m hare
11 EOF
12 test_must_fail env EDITOR=./hare-editor git commit --allow-empty -m tortoise -e &&
13 git show -s --pretty=format:%s >subject &&
14 grep hare subject &&
9fdc79ec
ÆAB
15 git show -s --pretty=format:%P >out &&
16 test_must_be_empty out
a908a31c
MH
17'
18
19test_expect_success 'race to create non-orphan commit' '
20 write_script airplane-editor <<-\EOF &&
21 git commit --allow-empty -m airplane
22 EOF
23 git checkout --orphan branch &&
24 git commit --allow-empty -m base &&
25 git rev-parse HEAD >base &&
26 test_must_fail env EDITOR=./airplane-editor git commit --allow-empty -m ship -e &&
27 git show -s --pretty=format:%s >subject &&
28 grep airplane subject &&
29 git rev-parse HEAD^ >parent &&
30 test_cmp base parent
31'
32
33test_done