X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-commit.sh;h=d7f3ade493762140c9a5a888ac67f8435e737f10;hb=1ef9e05dbf36a80bb65fb150dd7bdd60852db777;hp=15482d21b31dadaf53bf831be2de4d6f8b269b33;hpb=31262627109476c529418132e0820687003fb1fe;p=git.git diff --git a/git-commit.sh b/git-commit.sh index 15482d21b..d7f3ade49 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -199,6 +199,7 @@ only= logfile= use_commit= amend= +edit_flag= no_edit= log_given= log_message= @@ -246,7 +247,7 @@ do shift ;; -e|--e|--ed|--edi|--edit) - no_edit= + edit_flag=t shift ;; -i|--i|--in|--inc|--incl|--inclu|--includ|--include) @@ -384,6 +385,7 @@ $1" ;; esac done +case "$edit_flag" in t) no_edit= ;; esac ################################################################ # Sanity check options @@ -564,6 +566,9 @@ then elif test -f "$GIT_DIR/MERGE_HEAD" && test -f "$GIT_DIR/MERGE_MSG" then cat "$GIT_DIR/MERGE_MSG" +elif test -f "$GIT_DIR/SQUASH_MSG" +then + cat "$GIT_DIR/SQUASH_MSG" fi | git-stripspace >"$GIT_DIR"/COMMIT_EDITMSG case "$signoff" in @@ -661,7 +666,7 @@ else fi if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ] then - rm -f "$GIT_DIR/COMMIT_EDITMSG" + rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG" run_status exit 1 fi @@ -691,13 +696,18 @@ t) fi esac -sed -e ' - /^diff --git a\/.*/{ - s/// - q - } - /^#/d -' "$GIT_DIR"/COMMIT_EDITMSG | +if test -z "$no_edit" +then + sed -e ' + /^diff --git a\/.*/{ + s/// + q + } + /^#/d + ' "$GIT_DIR"/COMMIT_EDITMSG +else + cat "$GIT_DIR"/COMMIT_EDITMSG +fi | git-stripspace >"$GIT_DIR"/COMMIT_MSG if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG | @@ -713,7 +723,8 @@ then rm -f "$TMP_INDEX" fi && commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) && - git-update-ref HEAD $commit $current && + rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) && + git-update-ref -m "commit: $rlogm" HEAD $commit $current && rm -f -- "$GIT_DIR/MERGE_HEAD" && if test -f "$NEXT_INDEX" then @@ -726,7 +737,7 @@ else false fi ret="$?" -rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" +rm -f "$GIT_DIR/COMMIT_MSG" "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG" if test -d "$GIT_DIR/rr-cache" then git-rerere