summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junio@twinsun.com>2005-09-30 14:26:57 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-01 23:19:33 -0700
commit8098a178b26dc7a158d129a092a5b78da6d12b72 (patch)
treea91aec067dd33319e2f33de565c42ef43b449b56 /git-commit.sh
parenta876ed83be5467d6075da8a16306724cb1babc2a (diff)
downloadgit-8098a178b26dc7a158d129a092a5b78da6d12b72.tar.gz
Add git-symbolic-ref
This adds the counterpart of git-update-ref that lets you read and create "symbolic refs". By default it uses a symbolic link to represent ".git/HEAD -> refs/heads/master", but it can be compiled to use the textfile symbolic ref. The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah .git/HEAD' have been converted to use new git-symbolic-ref command, so that they can deal with either implementation. Signed-off-by: Junio C Hamano <junio@twinsun.com>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh17
1 files changed, 8 insertions, 9 deletions
diff --git a/git-commit.sh b/git-commit.sh
index 18b259c708..1206c20c2e 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -153,15 +153,8 @@ if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
fi >>.editmsg
PARENTS="-p HEAD"
-if [ ! -r "$GIT_DIR/HEAD" ]; then
- if [ -z "$(git-ls-files)" ]; then
- echo Nothing to commit 1>&2
- exit 1
- fi
- PARENTS=""
- current=
-else
- current=$(git-rev-parse --verify HEAD)
+if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1
+then
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
fi
@@ -194,6 +187,12 @@ else
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
fi
+else
+ if [ -z "$(git-ls-files)" ]; then
+ echo Nothing to commit 1>&2
+ exit 1
+ fi
+ PARENTS=""
fi
git-status >>.editmsg
if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ]