git-commit: make sure we protect against races.
An earlier commit 8098a178b2
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>
This commit is contained in:
@ -595,12 +595,14 @@ then
|
|||||||
PARENTS=$(git-cat-file commit HEAD |
|
PARENTS=$(git-cat-file commit HEAD |
|
||||||
sed -n -e '/^$/q' -e 's/^parent /-p /p')
|
sed -n -e '/^$/q' -e 's/^parent /-p /p')
|
||||||
fi
|
fi
|
||||||
|
current=$(git-rev-parse --verify HEAD)
|
||||||
else
|
else
|
||||||
if [ -z "$(git-ls-files)" ]; then
|
if [ -z "$(git-ls-files)" ]; then
|
||||||
echo >&2 Nothing to commit
|
echo >&2 Nothing to commit
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
PARENTS=""
|
PARENTS=""
|
||||||
|
current=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user