{"thread":{"id":"24297","subject":"Commit ending in \\ breaks rebase commitlog parsing","startedAt":"2010-07-05T20:24:22Z","lastAt":"2010-07-06T05:57:51Z","messageCount":2,"participants":["Joshua ben Jore","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"144846","messageId":"AANLkTim8BGaTvaBFdNDeQp26hwMCztScZFoIHI00DjkD@mail.gmail.com","threadId":"24297","inReplyTo":null,"subject":"Commit ending in \\ breaks rebase commitlog parsing","fromName":"Joshua ben Jore","fromEmail":"twists@gmail.com","sentAt":"2010-07-05T20:24:22Z","receivedAt":"2010-07-05T20:24:22Z","isPatch":false,"sender":{"key":"twists@gmail.com","avatar":null},"body":"Hi,\nThrough typos on my part, I have a commit with a message ending in a \\.\n\n    Prefer ! and && to \\\\not\\ and 'and\\\n\nThe rebase command or something it is using is parsing this\nincorrectly and leaving my .git in a \"bad\" state.\n\n    pick 43d2369 Prefer ! and && to\n    ot and 'and8c7ee99 Upgrade to Devel::PPPort-3.19\n\nThat should have read:\n\n    pick 43d2369 Perefer ! and && to \\\\not\\ and 'and\\\n    pick 8c7ee99 Upgrade to Devel::PPPort-3.19\n\nInitially, I started editing my pick list to be proper and was\nreceiving some strange sort of parsing errors but now am not. I'd\nmanually edited the backup picklist file in .git as well. For a repro,\nI tried the following. This also seems to show up a perhaps related\nproblem of a commit message consisting of only a single backslash. The\npick list just *drops* the commit, perhaps because some layer thinks\nthe commit message is empty?\n\n    mkdir slash\n    cd slash\n    git init\n\n    echo data1 > foo\n    git add foo\n    git commit -m root\n    export PARENT=$(git rev-parse HEAD)\n\n    echo data2 > foo\n    git add foo\n    git commit -m \\\\\n\n    echo data3 > foo\n    git add foo\n    git commit -m next\n\n    git rebase -i $PARENT\n    # .git/rebase-merge/git-rebase-todo is now incorrect\n\nJosh\n"},{"id":"144875","messageId":"7vfwzx5ezk.fsf@alter.siamese.dyndns.org","threadId":"24297","inReplyTo":"AANLkTim8BGaTvaBFdNDeQp26hwMCztScZFoIHI00DjkD@mail.gmail.com","subject":"Re: Commit ending in \\ breaks rebase commitlog parsing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-07-06T05:57:51Z","receivedAt":"2010-07-06T05:57:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joshua ben Jore <twists@gmail.com> writes:\n\n> ... The\n> pick list just *drops* the commit, perhaps because some layer thinks\n> the commit message is empty?\n\nThe problem is that we use \"read\" in shell to read these insn in the todo\nlist line by line, but a backslash at the end of line acts as a line\ncontinuation signal.  POSIX compliant shells are supposed to understand\n\"read -r\", so perhaps something like this may help.\n\n\n git-rebase--interactive.sh |   10 +++++-----\n 1 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex ed57552..31e6860 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -450,7 +450,7 @@ record_in_rewritten() {\n \n do_next () {\n \trm -f \"$MSG\" \"$AUTHOR_SCRIPT\" \"$AMEND\" || exit\n-\tread command sha1 rest < \"$TODO\"\n+\tread -r command sha1 rest < \"$TODO\"\n \tcase \"$command\" in\n \t'#'*|''|noop)\n \t\tmark_action_done\n@@ -591,7 +591,7 @@ do_rest () {\n # skip picking commits whose parents are unchanged\n skip_unnecessary_picks () {\n \tfd=3\n-\twhile read command sha1 rest\n+\twhile read -r command sha1 rest\n \tdo\n \t\t# fd=3 means we skip the command\n \t\tcase \"$fd,$command,$(git rev-parse --verify --quiet $sha1^)\" in\n@@ -644,13 +644,13 @@ rearrange_squash () {\n \ttest -s \"$1.sq\" || return\n \n \tused=\n-\twhile read pick sha1 message\n+\twhile read -r pick sha1 message\n \tdo\n \t\tcase \" $used\" in\n \t\t*\" $sha1 \"*) continue ;;\n \t\tesac\n \t\techo \"$pick $sha1 $message\"\n-\t\twhile read squash action msg\n+\t\twhile read -r squash action msg\n \t\tdo\n \t\t\tcase \"$message\" in\n \t\t\t\"$msg\"*)\n@@ -891,7 +891,7 @@ first and then run 'git rebase --continue' again.\"\n \t\t\t--abbrev=7 --reverse --left-right --topo-order \\\n \t\t\t$REVISIONS | \\\n \t\t\tsed -n \"s/^>//p\" |\n-\t\twhile read shortsha1 rest\n+\t\twhile read -r shortsha1 rest\n \t\tdo\n \t\t\tif test t != \"$PRESERVE_MERGES\"\n \t\t\tthen\n"}]}