git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mickey Killianey <mickey@killianey.com>
To: git <git@vger.kernel.org>
Subject: Bug report: using git commit-tree with "-F -" adds trailing newlines
Date: Thu, 24 Oct 2013 05:22:12 -0700	[thread overview]
Message-ID: <CACAUoX6zT0wXxCLXK+sk0e4hgfD_A_EWWKvWnTOXK0-hzw7BUg@mail.gmail.com> (raw)

I believe I've stumbled across an inconsistency in how git commit-tree
reads messages from stdin.  I would expect the behavior of these two
commands to be identical, and that neither would actually change any
commits:

    git filter-branch --commit-filter 'git commit-tree $@'
    git filter-branch --commit-filter 'git commit-tree -F - $@'

(If that assumption is untrue, please feel free to correct me and
disregard the rest of this message.)

What I'm observing is that if I add a commit with a message that
doesn't end in a trailing newline, like this:

    git merge `echo -n "No trailing newline" | git commit-tree
HEAD^{tree} -p HEAD`

Then I get different behavior in different versions of Git on
different platforms.  On git 1.8.4 on Ubuntu 12.04 (build from
https://launchpad.net/~git-core/+archive/ppa) under GNU bash, version
4.2.25(1)-release (x86_64-pc-linux-gnu), using "-F -" seems to add a
linefeed to the body:

    $ git log -n 1 --format=:%H:%B:
    : 4a11052c110c3daea46c89ae1118b1a2c59cc01b:No trailing newline:
    $ git filter-branch --commit-filter 'git commit-tree $@'
    Rewrite 4a11052c110c3daea46c89ae1118b1a2c59cc01b (2/2)
    WARNING: Ref 'refs/heads/master' is unchanged
    $ git filter-branch --commit-filter 'git commit-tree -F - $@'
    Rewrite 4a11052c110c3daea46c89ae1118b1a2c59cc01b (2/2)
    Ref 'refs/heads/master' was rewritten
    $ git log -n 1 --format=:%H:%B:
    :5ecba0ff0ca1290f2a5e3a599622e2a59e311f67:No trailing newline
    :

On git 1.7.12.4 (Apple Git-37) on Mac OS X 10.8.5 using GNU bash,
version 3.2.48(1)-release (x86_64-apple-darwin12), both commands (with
and without the "-F -" add newlines to the body of the commits.

Thanks for your attention!

Mick

                 reply	other threads:[~2013-10-24 12:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACAUoX6zT0wXxCLXK+sk0e4hgfD_A_EWWKvWnTOXK0-hzw7BUg@mail.gmail.com \
    --to=mickey@killianey.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).