git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: huebbe <nathanael.huebbe@informatik.uni-hamburg.de>
To: git@vger.kernel.org
Subject: Bug: Incorrect stripping of the [PATCH] prefix in git-am
Date: Wed, 25 Nov 2015 16:29:30 +0100	[thread overview]
Message-ID: <5655D3DA.1050403@informatik.uni-hamburg.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]

Description:

When applying a patch created via `git format-patch` with `git am`,
any prefix of the commit message that's within square brackets is stripped from the commit message.


Reproduction:

    $ git log --oneline --decorate --graph --all
    * b41514b (HEAD) [baz] baz
    | * 5e31740 (master) [bar] bar
    |/
    * aaf5d34 [foo] foo
    $ git format-patch aaf5d34
    $ git checkout master
    $ git am 0001-baz-baz.patch
    $ git log --oneline --decorate --graph --all
    * d5161b8 (HEAD, master) baz
    * 5e31740 [bar] bar
    * aaf5d34 [foo] foo

I have omitted all output except for the `git log` output for brevity.
As you can see, the commit resulting from `git am` has lost the "[bar]" prefix from its commit message.

Looking at the patch,

    $ cat 0001-baz-baz.patch
    From b41514be8a70fd44052bff0d3ce720373ec9cfd8 Mon Sep 17 00:00:00 2001
    From: Nathanael Huebbe <nathanael.huebbe@informatik.uni-hamburg.de>
    Date: Wed, 25 Nov 2015 15:28:09 +0100
    Subject: [PATCH] [baz] baz

    ---
     baz | 1 +
     1 file changed, 1 insertion(+)
     create mode 100644 baz

    diff --git a/baz b/baz
    new file mode 100644
    index 0000000..7601807
    --- /dev/null
    +++ b/baz
    @@ -0,0 +1 @@
    +baz
    --
    2.1.4

I see that the commit message contains the "[PATCH]"-prefix that `git am` is supposed to strip,
yet it seems to incorrectly continue to also strip the "[baz]"-prefix.


Affected versions:
I have reproduced the bug with versions 1.9.1, 2.1.4, and 2.6.3


Severity:
While I do not consider this a high priority bug, it becomes quite irksome in some workflows.
In my case, an upstream `svn` repository has the policy of using "[branch-name]" prefixes
to the commit messages, which are stripped whenever I transplant a commit using the
`git format-patch`/`git am` combination.



-- 
Please be aware that the enemies of your civil rights and your freedom
are on CC of all unencrypted communication. Protect yourself.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

             reply	other threads:[~2015-11-25 15:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 15:29 huebbe [this message]
2015-11-25 15:44 ` Bug: Incorrect stripping of the [PATCH] prefix in git-am stefan.naewe
2015-11-25 15:59   ` huebbe
2015-12-02  0:58     ` Jeff King
2015-12-02  1:10       ` Stefan Beller
2015-12-02  2:27         ` Junio C Hamano
2015-12-02  2:24       ` Junio C Hamano
2015-12-02 12:38       ` huebbe
2015-12-02 15:49         ` Jeff King
2015-12-03 10:32           ` huebbe

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=5655D3DA.1050403@informatik.uni-hamburg.de \
    --to=nathanael.huebbe@informatik.uni-hamburg.de \
    --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).