git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug: git-rebase goofs up \n in commit messages

From
SISzekeres Istvan <szekeres@iii.hu>
Date
May 25, 2007, 21:11 UTC
Message-ID
<465750FE.9000406@iii.hu>
Hello,

while playing with git I found the following bug: if a commit message contains "\n" (as a string, not as a character), git-rebase changes this string into a literal newline character.

This is how to reproduce it:

mkdir tmp cd tmp git init-db echo xx > xx.txt git add xx.txt git commit -m foo echo xx >> xx.txt git add xx.txt git commit -m foo git branch other 'HEAD^' git checkout other echo yy > yy.txt git add yy.txt git commit -m 'foo \\n bar' git log 'HEAD^..' [1] git rebase master git log 'HEAD^..' [2]

The output of [1] is the following (correctly):
commit 694daa542b83dc1bbd6c070630f73c9a111f6e40
Author: Istvan Szekeres <szekeres@iii.hu>
Date:   Fri May 25 23:09:32 2007 +0200
    foo \n bar
The output of [2] is the following (wrong!):
commit 68ba80d2927d4e21c7a1d1d758f9023dbe063bde
Author: Istvan Szekeres <szekeres@iii.hu>
Date:   Fri May 25 22:58:28 2007 +0200
    foo
     bar
....
I think this is a bug.

Best regards, Istvan

Next: Jeff King
Message 1 of 13 in “Bug: git-rebase goofs up \n in commit messages”
  1. Szekeres IstvanMay 25, 2007
  2. Jeff KingMay 26, 2007
  3. Herbert XuMay 26, 2007
  4. Jeff KingMay 26, 2007
  5. Junio C HamanoMay 26, 2007
  6. Junio C HamanoMay 26, 2007
  7. Jeff KingMay 26, 2007
  8. Junio C HamanoMay 26, 2007
  9. Herbert XuMay 26, 2007
  10. Jeff KingMay 26, 2007
  11. Herbert XuMay 26, 2007
  12. Jeff KingMay 26, 2007
  13. Junio C HamanoMay 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.