summaryrefslogtreecommitdiffstats
path: root/git-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-28 03:14:27 +0200
committerJunio C Hamano <junkio@cox.net>2005-09-29 01:42:44 +0200
commitbf7960eb51a26bcf52f27a60bfcf005661266b1e (patch)
treebaeef0ee852f787668eceadd7aefa29b79add7a7 /git-commit.sh
parent[PATCH] Make some needlessly global stuff static (diff)
downloadgit-bf7960eb51a26bcf52f27a60bfcf005661266b1e.tar.xz
git-bf7960eb51a26bcf52f27a60bfcf005661266b1e.zip
Use git-update-ref in scripts.
This uses the git-update-ref command in scripts for safer updates. Also places where we used to read HEAD ref by using "cat" were fixed to use git-rev-parse. This will matter when we start using symbolic references. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/git-commit.sh b/git-commit.sh
index 18ad36158d..18b259c708 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -159,7 +159,9 @@ if [ ! -r "$GIT_DIR/HEAD" ]; then
exit 1
fi
PARENTS=""
+ current=
else
+ current=$(git-rev-parse --verify HEAD)
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
fi
@@ -220,7 +222,7 @@ if test -s .cmitchk
then
tree=$(git-write-tree) &&
commit=$(cat .cmitmsg | git-commit-tree $tree $PARENTS) &&
- echo $commit > "$GIT_DIR/HEAD" &&
+ git-update-ref HEAD $commit $current &&
rm -f -- "$GIT_DIR/MERGE_HEAD"
else
echo >&2 "* no commit message? aborting commit."