Merge branch 'maint-2.5' into maint-2.6
[gitweb.git] / git-rebase--interactive.sh
index d65c06eff36f09c982d66b11684d8f3ab3784393..b938a6d4aa86b5f1e75312188c71cc4b0cdaab23 100644 (file)
@@ -77,6 +77,10 @@ amend="$state_dir"/amend
 rewritten_list="$state_dir"/rewritten-list
 rewritten_pending="$state_dir"/rewritten-pending
 
+# Work around Git for Windows' Bash whose "read" does not strip CRLF
+# and leaves CR at the end instead.
+cr=$(printf "\015")
+
 strategy_args=
 if test -n "$do_merge"
 then
@@ -518,6 +522,10 @@ do_next () {
        "$comment_char"*|''|noop|drop|d)
                mark_action_done
                ;;
+       "$cr")
+               # Work around CR left by "read" (e.g. with Git for Windows' Bash).
+               mark_action_done
+               ;;
        pick|p)
                comment_for_reflog pick
 
@@ -602,7 +610,7 @@ do_next () {
                read -r command rest < "$todo"
                mark_action_done
                printf 'Executing: %s\n' "$rest"
-               ${SHELL:-@SHELL_PATH@} -c "$rest" # Actual execution
+               "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
                status=$?
                # Run in subshell because require_clean_work_tree can die.
                dirty=f
@@ -896,6 +904,10 @@ check_bad_cmd_and_sha () {
                "$comment_char"*|''|noop|x|exec)
                        # Doesn't expect a SHA-1
                        ;;
+               "$cr")
+                       # Work around CR left by "read" (e.g. with Git for
+                       # Windows' Bash).
+                       ;;
                pick|p|drop|d|reword|r|edit|e|squash|s|fixup|f)
                        if ! check_commit_sha "${rest%%[        ]*}" "$lineno" "$1"
                        then