[PATCH v2 0/2] Fix interactive rebase when the editor saves with CR/LF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 proposed fix is to teach *all* shell scripts in Git to accept CR as
a field separator. Since LF is already specified as such, it should be
an uncontentious change.


Johannes Schindelin (2):
  Demonstrate rebase fails when the editor saves with CR/LF
  sh-setup: explicitly mark CR as a field separator

 git-sh-setup.sh               |  4 ++--
 t/t3404-rebase-interactive.sh | 12 ++++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

Interdiff vs v1:

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 94dfe04..e34673d 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -11,7 +11,7 @@ unset CDPATH
 
 # Similarly for IFS, but some shells (e.g. FreeBSD 7.2) are buggy and
 # do not equate an unset IFS with IFS with the default, so here is
-# an explicit SP HT LF.
+# an explicit SP HT LF CR.
 IFS=' 	
-'"$(printf '
')"
+'"$(printf '\r')"
 

-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]