git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Lehmann <Jens.Lehmann@web.de>
To: Christopher Dunn <cdunn2001@gmail.com>, git@vger.kernel.org
Subject: Re: format-patch and submodules
Date: Tue, 09 Jun 2015 20:52:22 +0200	[thread overview]
Message-ID: <557735E6.8040906@web.de> (raw)
In-Reply-To: <CAD2z=MAu1qrr9=wwBnOJZZ3JCJOsmFWi=gDgKMQKU3_P-01e3g@mail.gmail.com>

Am 05.06.2015 um 01:20 schrieb Christopher Dunn:
> (Seen in git versions: 2.1.0 and 1.9.3 et al.)
>
> $ git format-patch --stdout X^..X | git apply check -
> fatal: unrecognized input
>
> This fails when the commit consists of nothing but a submodule change
> (as in 'git add submodule foo'), but it passes when a file change is
> added to the same commit.
>
> There used to be a similar problem for empty commits, but that was
> fixed around git-1.8:
>
>      http://stackoverflow.com/questions/20775132/cannot-apply-git-patch-replacing-a-file-with-a-link
>
> Now, 'git format-patch' outputs nothing for an empty commit. I suppose
> that needs to be the behavior also when only submodules are changed,
> since in that case there is no 'diff' section from 'format-patch'.
>
> Use-case: git-p4
>
> Of course, we do not plan to add the submodule into Perforce, but we
> would like this particular command to behave the same whether there
> are other diffs or not.

Hmm, I'm not sure that this is a bug. It looks to me like doing a

$ git format-patch --stdout X^..X | git apply check -

when nothing is changed except submodules and expecting it to work
is the cause of the problem.

I get the same error when I do:

$git format-patch --stdout master..master | git apply --check -
fatal: unrecognized input

No submodules involved, just an empty patch.

I assume you want to ignore all submodule changes, so you should
check if e.g. "git diff --ignore-submodules X^..X" returns anything
before applying that? (From the command you ran I assume you might
be able to drop the --ignore-submodules because you already did set
"diff.ignoreSubmodules" to "all"?)

  reply	other threads:[~2015-06-09 18:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 23:20 format-patch and submodules Christopher Dunn
2015-06-09 18:52 ` Jens Lehmann [this message]
2015-06-10 17:04   ` Christopher Dunn
2015-06-10 21:14     ` Luke Diamand
2015-06-10 22:41       ` Christopher Dunn

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=557735E6.8040906@web.de \
    --to=jens.lehmann@web.de \
    --cc=cdunn2001@gmail.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.
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).