From: Johannes Schindelin <johannes.schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Matthieu Moy <Matthieu.Moy@imag.fr>,
Chad Boles <chadbo@microsoft.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
Philip Oakley <philipoakley@iee.org>
Subject: [PATCH v4 0/2] Fix interactive rebase when the editor saves with CR/LF
Date: Wed, 28 Oct 2015 15:54:14 +0100 (CET) [thread overview]
Message-ID: <cover.1446043983.git.johannes.schindelin@gmx.de> (raw)
In-Reply-To: <cover.1445939154.git.johannes.schindelin@gmx.de>
Chad Boles reported that `git rebase -i` recently started producing
errors when the editor saves files with DOS line endings. The symptom
is:
Warning: the command isn't recognized in the following line:
-
You can fix this with 'git rebase --edit-todo'.
Or you can abort the rebase with 'git rebase --abort'.
The real bummer is that simply calling `git rebase --continue` "fixes"
it.
Turns out that we now check whether a single Carriage Return is a valid
command. This new check was introduced recently (1db168ee9, ironically
named "rebase-i: loosen over-eager check_bad_cmd check").
The fix provided by Junio works around this issue by testing for an
explicit trailing carriage return and handles it like an empty line.
Unfortunately, this is the best we can do for now as there is
disagreement about a more general fix.
This iteration clarifies the comments in git-rebase--interactive,
updates the commit message to state that this has been tested with Git
for Windows, and replaces the description of the proposed fix with a
description of the actual work-around provided by Junio.
Johannes Schindelin (1):
Demonstrate rebase fails when the editor saves with CR/LF
Junio C Hamano (1):
rebase-i: work around Windows CRLF line endings
git-rebase--interactive.sh | 12 ++++++++++++
t/t3404-rebase-interactive.sh | 12 ++++++++++++
2 files changed, 24 insertions(+)
Interdiff vs v3:
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index daadf2d..34cfe66 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -77,8 +77,7 @@ amend="$state_dir"/amend
rewritten_list="$state_dir"/rewritten-list
rewritten_pending="$state_dir"/rewritten-pending
-# Work around a Windows port of shell that does not strip
-# the newline at the end of a line correctly.
+# Work around Git for Windows' Bash that strips only LFs but no CRs.
cr=$(printf "\015")
strategy_args=
@@ -523,8 +522,8 @@ do_next () {
mark_action_done
;;
"$cr")
- # Windows port of shell not stripping the newline
- # at the end of an empty line correctly.
+ # Work around Carriage Returns not being stripped (e.g. with
+ # Git for Windows' Bash).
mark_action_done
;;
pick|p)
@@ -906,8 +905,8 @@ check_bad_cmd_and_sha () {
# Doesn't expect a SHA-1
;;
"$cr")
- # Windows port of shell not stripping the newline
- # at the end of an empty line correctly.
+ # Work around Carriage Returns not being stripped
+ # (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"
--
2.1.4
next prev parent reply other threads:[~2015-10-28 14:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-25 12:49 [PATCH 0/2] Fix interactive rebase when the editor saves with CR/LF Johannes Schindelin
2015-10-25 12:50 ` [PATCH 1/2] Demonstrate rebase fails " Johannes Schindelin
2015-10-25 12:50 ` [PATCH 2/2] sh-setup: explicitly mark CR as a field separator Johannes Schindelin
2015-10-25 13:16 ` Philip Oakley
2015-10-25 13:26 ` Johannes Schindelin
[not found] ` <20151025131059.GA370025@vauxhall.crustytoothpaste.net>
2015-10-25 13:25 ` Johannes Schindelin
2015-10-25 13:56 ` shell scripting woes, was " Johannes Schindelin
2015-10-25 14:10 ` [PATCH v2 0/2] Fix interactive rebase when the editor saves with CR/LF Johannes Schindelin
2015-10-25 14:10 ` [PATCH v2 1/2] Demonstrate rebase fails " Johannes Schindelin
2015-10-25 14:10 ` [PATCH v2 2/2] sh-setup: explicitly mark CR as a field separator Johannes Schindelin
2015-10-26 9:34 ` Matthieu Moy
2015-10-26 18:31 ` Junio C Hamano
2015-10-26 20:07 ` Junio C Hamano
2015-10-27 9:46 ` Johannes Schindelin
2015-10-27 9:19 ` Johannes Schindelin
2015-10-27 17:46 ` Junio C Hamano
2015-10-27 10:01 ` Matthieu Moy
2015-10-25 19:12 ` [PATCH v2 0/2] Fix interactive rebase when the editor saves with CR/LF Junio C Hamano
2015-10-26 10:43 ` Johannes Schindelin
2015-10-26 19:13 ` Junio C Hamano
2015-10-27 9:34 ` Johannes Schindelin
2015-10-27 9:47 ` [PATCH v3 " Johannes Schindelin
2015-10-27 9:47 ` [PATCH v3 1/2] Demonstrate rebase fails " Johannes Schindelin
2015-10-27 9:47 ` [PATCH v3 2/2] rebase-i: work around Windows CRLF line endings Johannes Schindelin
2015-10-27 9:55 ` Johannes Schindelin
2015-10-27 17:25 ` Junio C Hamano
2015-10-28 14:56 ` Johannes Schindelin
2015-10-28 14:54 ` Johannes Schindelin [this message]
2015-10-28 14:54 ` [PATCH v4 1/2] Demonstrate rebase fails when the editor saves with CR/LF Johannes Schindelin
2015-10-28 14:54 ` [PATCH v4 2/2] rebase-i: work around Windows CRLF line endings Johannes Schindelin
2015-10-28 17:12 ` [PATCH v4 0/2] Fix interactive rebase when the editor saves with CR/LF Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1446043983.git.johannes.schindelin@gmx.de \
--to=johannes.schindelin@gmx.de \
--cc=Matthieu.Moy@imag.fr \
--cc=chadbo@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=philipoakley@iee.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).