summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-03-02 21:13:24 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-03-02 21:13:24 -0800
commitb8310152bc5622e4d449e3113ba4edec8fd08087 (patch)
tree23d780130edc411a02cc946f8c03bf5c9b7fb255 /git-commit.sh
parentgit-commit --amend (diff)
downloadtgif-b8310152bc5622e4d449e3113ba4edec8fd08087.tar.xz
git-commit: make sure we protect against races.
An earlier commit 8098a178b26dc7a158d129a092a5b78da6d12b72 accidentally lost race protection from git-commit command. This commit reinstates it. When something else updates HEAD pointer while you were editing your commit message, the command would notice and abort the commit. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/git-commit.sh b/git-commit.sh
index c9c22abc5e..d9ec1f14d9 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -595,12 +595,14 @@ then
PARENTS=$(git-cat-file commit HEAD |
sed -n -e '/^$/q' -e 's/^parent /-p /p')
fi
+ current=$(git-rev-parse --verify HEAD)
else
if [ -z "$(git-ls-files)" ]; then
echo >&2 Nothing to commit
exit 1
fi
PARENTS=""
+ current=
fi
{