{"thread":{"id":"36162","subject":"[PATCH v2] rebase -i: replace an echo command by printf","startedAt":"2014-03-14T23:56:43Z","lastAt":"2014-03-18T00:10:55Z","messageCount":3,"participants":["Uwe Storbeck","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"236762","messageId":"20140314235642.GA6917@ibr.ch","threadId":"36162","inReplyTo":null,"subject":"[PATCH v2] rebase -i: replace an echo command by printf","fromName":"Uwe Storbeck","fromEmail":"uwe@ibr.ch","sentAt":"2014-03-14T23:56:43Z","receivedAt":"2014-03-14T23:56:43Z","isPatch":true,"sender":{"key":"uwe@ibr.ch","avatar":null},"body":"to avoid shell dependent behavior.\n\nWhen your system shell (/bin/sh) is a dash backslash sequences\nin strings are interpreted by the echo command. A commit message\nwhich ends with the string '\\n' may result in a garbage line in\nthe todo list of an interactive rebase which causes the rebase\nto fail.\n\nTo reproduce the behavior (with dash as /bin/sh):\n\n  mkdir test && cd test && git init\n  echo 1 >foo && git add foo\n  git commit -m\"this commit message ends with '\\n'\"\n  echo 2 >foo && git commit -a --fixup HEAD\n  git rebase -i --autosquash --root\n\nNow the editor opens with garbage in line 3 which has to be\nremoved or the rebase fails.\n\nSigned-off-by: Uwe Storbeck <uwe@ibr.ch>\n---\n git-rebase--interactive.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 43c19e0..43631b4 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -739,7 +739,7 @@ rearrange_squash () {\n \t\t\t\t\t;;\n \t\t\t\tesac\n \t\t\tdone\n-\t\t\techo \"$sha1 $action $prefix $rest\"\n+\t\t\tprintf '%s %s %s %s\\n' \"$sha1\" \"$action\" \"$prefix\" \"$rest\"\n \t\t\t# if it's a single word, try to resolve to a full sha1 and\n \t\t\t# emit a second copy. This allows us to match on both message\n \t\t\t# and on sha1 prefix\n-- \n1.9.0\n"},{"id":"236901","messageId":"xmqqa9coeikj.fsf@gitster.dls.corp.google.com","threadId":"36162","inReplyTo":"20140314235642.GA6917@ibr.ch","subject":"Re: [PATCH v2] rebase -i: replace an echo command by printf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-17T19:22:36Z","receivedAt":"2014-03-17T19:22:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Uwe Storbeck <uwe@ibr.ch> writes:\n\n> to avoid shell dependent behavior.\n\nPlease do not start the body of the log message half-sentence.  The\ntitle ought to be a freestanding \"title\", not just a beginning half\nof a sentence that needs to be read with the rest to be understood.\n\nSomething like this, perhaps.\n\n    Subject: [PATCH] rebase -i: do not \"echo\" random user-supplied strings\n\n    In some places we \"echo\" a string that come from a commit log message,\n    which may have a backslash sequence that is interpreted by shells\n    (POSIX.1 allows this), most notably \"dash\".\n\n    A commit message which contains the string '\\n' (or ends with the\n    string '\\c') may result in a garbage line in the todo list of an\n    interactive rebase which causes the rebase to fail.\n\nWill tentatively queue with the above rewrite, but if you feel\nstrongly, please send an replacement.\n\nThanks.\n"},{"id":"236944","messageId":"20140318001054.GC1971@ibr.ch","threadId":"36162","inReplyTo":"xmqqa9coeikj.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] rebase -i: replace an echo command by printf","fromName":"Uwe Storbeck","fromEmail":"uwe@ibr.ch","sentAt":"2014-03-18T00:10:55Z","receivedAt":"2014-03-18T00:10:55Z","isPatch":true,"sender":{"key":"uwe@ibr.ch","avatar":null},"body":"On Mar 17, Junio C Hamano wrote:\n> Will tentatively queue with the above rewrite, but if you feel\n> strongly, please send an replacement.\n\nNo need for a replacement, your wording is good. I couldn't do\nit better.\n\nI'll borrow your commit message for my other patch to fix the\ncontinued title there too. If you already have queued and\nrewritten that patch you may keep your version.\n\nThanks\n\nUwe\n"}]}