docs/diff-options: clarify scope of diff-filter types
[gitweb.git] / git-rebase--interactive.sh
index ca994c5c545cb0394fc5d355ecb6ea2fe5f1f193..4734094a3f1aaa7d7c767a0740b46dd6abdd6f7a 100644 (file)
@@ -93,8 +93,17 @@ eval '
 GIT_CHERRY_PICK_HELP="$resolvemsg"
 export GIT_CHERRY_PICK_HELP
 
-comment_char=$(git config --get core.commentchar 2>/dev/null | cut -c1)
-: ${comment_char:=#}
+comment_char=$(git config --get core.commentchar 2>/dev/null)
+case "$comment_char" in
+'' | auto)
+       comment_char="#"
+       ;;
+?)
+       ;;
+*)
+       comment_char=$(echo "$comment_char" | cut -c1)
+       ;;
+esac
 
 warn () {
        printf '%s\n' "$*" >&2
@@ -416,7 +425,7 @@ update_squash_messages () {
        if test -f "$squash_msg"; then
                mv "$squash_msg" "$squash_msg".bak || exit
                count=$(($(sed -n \
-                       -e "1s/^$comment_char.*\([0-9][0-9]*\).*/\1/p" \
+                       -e "1s/^$comment_char[^0-9]*\([0-9][0-9]*\).*/\1/p" \
                        -e "q" < "$squash_msg".bak)+1))
                {
                        printf '%s\n' "$comment_char $(eval_ngettext \
@@ -428,7 +437,8 @@ update_squash_messages () {
                        }' <"$squash_msg".bak
                } >"$squash_msg"
        else
-               commit_message HEAD > "$fixup_msg" || die "$(gettext "Cannot write \$fixup_msg")"
+               commit_message HEAD >"$fixup_msg" ||
+               die "$(eval_gettext "Cannot write \$fixup_msg")"
                count=2
                {
                        printf '%s\n' "$comment_char $(gettext "This is a combination of 2 commits.")"