git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Szekeres Istvan <szekeres@iii.hu>
Cc: herbert@gondor.apana.org.au, git@vger.kernel.org
Subject: Re: Bug: git-rebase goofs up \n in commit messages
Date: Fri, 25 May 2007 20:40:28 -0400	[thread overview]
Message-ID: <20070526004028.GA8940@sigill.intra.peff.net> (raw)
In-Reply-To: <465750FE.9000406@iii.hu>

On Fri, May 25, 2007 at 11:11:26PM +0200, Szekeres Istvan wrote:

> 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.

Hmm. The culprit seems to be git-am.sh, line 313:

  SUBJECT="$(sed -n '/^Subject/ s/Subject: //p' "$dotest/info")"

and even more exciting, it seems to be a bash vs dash thing. Try this:

$ cat >content-with-escapes <<'EOF'
foo \n bar
EOF

$ bash
bash$ test=$(cat content-with-escapes)
bash$ echo $test
foo \n bar

$ dash
dash$ test=$(cat content-with-escapes)
dash$ echo $test
foo
 bar


Hmm. It even happens with this:

bash$ export test=$(echo foo \\n bar)
bash$ dash
dash$ echo $test
foo
 bar

I'm not sure what the best workaround is.  I am cc'ing Herbert Xu to see
if he has any helpful comments.

-Peff

  reply	other threads:[~2007-05-26  0:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-25 21:11 Bug: git-rebase goofs up \n in commit messages Szekeres Istvan
2007-05-26  0:40 ` Jeff King [this message]
2007-05-26  1:10   ` Herbert Xu
2007-05-26  3:42     ` Jeff King
2007-05-26  3:59       ` Junio C Hamano
2007-05-26  4:59       ` Junio C Hamano
2007-05-26  6:07         ` Jeff King
2007-05-26  6:13           ` Junio C Hamano
2007-05-26  6:19           ` Herbert Xu
2007-05-26  6:27             ` Jeff King
2007-05-26  7:38               ` Herbert Xu
2007-05-26  7:47                 ` Jeff King
2007-05-26  7:47           ` 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=20070526004028.GA8940@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=szekeres@iii.hu \
    /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).