4566: rbt post strips newlines in muli-line git comments

anshnd

What version are you running?

0.7.10

What steps will reproduce the problem?

  1. git commit -m $'first line\nsecond line'
  2. rbt post -o

What is the expected output? What do you see instead?

The description in ReviewBoard has lines joined together.
If you add -s option the added timestamp on the commit message
joins the lines in the commit as well.

What operating system are you using?

MacOS

Attach the debug out from the command.

$ rbt <command> --debug <args>
<debug output>
...
>>> Running: git log --reverse --pretty=format:%s%n%n%b ^e325f0f4d5900778ebf31983855d7ef60afca72b 00fe06e0212a9aa2329512f22fe80a00ac9661eb

note %s%n%n%b that it's getting the subject which Git interprets
as first paragraph in a single line followed by two newlines and
the 'body' which is the rest.

Please provide any additional information below.

The solution is to run with format:%B (raw body) as shown at https://git-scm.com/docs/git-log That way rbt does not mangle git's commit message
and reports it correctly to ReviewBoard

david
#1 david

Review Board parses git commit messages according to the "standard" conventions for them, as described by the authors of git. In this standard, the summary line of the commit should be separated from the body by two newline characters (a blank line in between). There's a good example of this at https://chris.beams.io/posts/git-commit/

  • -New
    +NotABug