summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-07-11 02:48:47 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-11 04:21:16 (GMT)
commita3a733e63bb8dfbd6921b8f405d652db1821d4fd (patch)
tree7ebf13c8bea66d7fbb6262f08f823bb958b05849 /git-commit.sh
parent0b0fe4a65d24d7c17d72706e5cd179ecc7134721 (diff)
downloadgit-a3a733e63bb8dfbd6921b8f405d652db1821d4fd.zip
git-a3a733e63bb8dfbd6921b8f405d652db1821d4fd.tar.gz
git-a3a733e63bb8dfbd6921b8f405d652db1821d4fd.tar.bz2
Record the type of commit operation in the reflog.
If committing a merge (.git/MERGE_HEAD exists), an initial tree (no HEAD) or using --amend to amend the prior commit then denote the subtype of commit in the reflog. This helps to distinguish amended or merge commits from normal commits. In the case of --amend the prior sha1 is probably the commit which is being thrown away in favor of the new commit. Since it is likely that the old commit doesn't have any ref pointing to it anymore it can be interesting to know why that the commit was replaced and orphaned. In the case of a merge the prior sha1 is probably the first parent of the new merge commit. Consequently having its prior sha1 in the reflog is slightly less interesting but its still informative to know the commit was the result of a merge which had to be completed by hand. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-commit.sh b/git-commit.sh
index 351d13c..802dd72 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -635,9 +635,12 @@ fi
PARENTS="-p HEAD"
if test -z "$initial_commit"
then
+ rloga='commit'
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
+ rloga='commit (merge)'
PARENTS="-p HEAD "`sed -e 's/^/-p /' "$GIT_DIR/MERGE_HEAD"`
elif test -n "$amend"; then
+ rloga='commit (amend)'
PARENTS=$(git-cat-file commit HEAD |
sed -n -e '/^$/q' -e 's/^parent /-p /p')
fi
@@ -649,6 +652,7 @@ else
fi
PARENTS=""
current=
+ rloga='commit (initial)'
fi
if test -z "$no_edit"
@@ -724,7 +728,7 @@ then
fi &&
commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) &&
- git-update-ref -m "commit: $rlogm" HEAD $commit $current &&
+ git-update-ref -m "$rloga: $rlogm" HEAD $commit $current &&
rm -f -- "$GIT_DIR/MERGE_HEAD" &&
if test -f "$NEXT_INDEX"
then