summaryrefslogtreecommitdiff
path: root/t/t7516-commit-races.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-02-17 18:00:18 +0100
committerJunio C Hamano <gitster@pobox.com>2015-02-17 11:24:20 -0800
commita933c23e66265eedf822535ac56fcdb4ecb07a8c (patch)
tree2248903b0d95e1bdf362828ebf5dd40507c3532b /t/t7516-commit-races.sh
parenta908a31c344cdcce2bf1a9fc163f3bccd2349e6a (diff)
downloadgit-a933c23e66265eedf822535ac56fcdb4ecb07a8c.tar.gz
commit: avoid race when creating orphan commits
If HEAD doesn't point at anything during the initial check, then we should make sure that it *still* doesn't point at anything when we are ready to update the reference. Otherwise, another process might commit while we are working (e.g., while we are waiting for the user to edit the commit message) and we will silently overwrite it. This fixes a failing test in t7516. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7516-commit-races.sh')
-rwxr-xr-xt/t7516-commit-races.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t7516-commit-races.sh b/t/t7516-commit-races.sh
index ed04d1c425..f2ce14e907 100755
--- a/t/t7516-commit-races.sh
+++ b/t/t7516-commit-races.sh
@@ -3,7 +3,7 @@
test_description='git commit races'
. ./test-lib.sh
-test_expect_failure 'race to create orphan commit' '
+test_expect_success 'race to create orphan commit' '
write_script hare-editor <<-\EOF &&
git commit --allow-empty -m hare
EOF