git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Wang Yugui <wangyugui@e16-tech.com>, git@vger.kernel.org
Subject: Re: git format-patch lost the last part when branch merge
Date: Mon, 22 Feb 2021 15:25:21 -0800	[thread overview]
Message-ID: <xmqqzgzv65y6.fsf@gitster.g> (raw)
In-Reply-To: <YDQ27qbbblPfLCpU@coredump.intra.peff.net> (Jeff King's message of "Mon, 22 Feb 2021 17:57:50 -0500")

Jeff King <peff@peff.net> writes:

> This is expected. Format-patch omits merge commits entirely, as they
> can't be formatted as a simple diff that can be applied.
>
> There are lots of ways to look at the diff of a merge. By default, `git
> show` will show a combined diff, which omits hunks where one side was
> taken verbatim, but otherwise shows what each side did.
>
> The diff shown in the link above is a diff against the first-parent
> (which you can also get locally with `git show --first-parent 582cd91`).
> One _could_ apply that diff onto the first parent to achieve the same
> tree as the merge plus all of the commits that got merged in. But it
> wouldn't make any sense to apply that (aside from conflict resolution,
> it would be redundant with all of the commits that format-patch just
> output!).

Yes, a first-parent diff is something you could call "a simple diff
that can be applied to represent a merge", and it is consistent with
the expectations of those who are used to do a squash (pseudo-)merge.

I agree with you that it does not make sense to apply such a patch
as a patch, of course.  In addition to be redundant, it would be an
equivalent of doing a squash (psuedo-)merge, and loses the "up to
this point the side branch has been merged, so future merges won't
have to look beyond this point in the past" (sort of going back to
the prehistoric subversion days that did not keep track of which
changes have been merged).

  parent reply	other threads:[~2021-02-22 23:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22 13:16 Wang Yugui
2021-02-22 22:57 ` Jeff King
2021-02-22 23:08   ` [PATCH] docs/format-patch: mention handling of merges Jeff King
2021-02-22 23:31     ` Junio C Hamano
2021-02-22 23:40       ` Jeff King
2021-02-23  1:24         ` Junio C Hamano
2021-02-23  1:48           ` Jeff King
2021-02-22 23:25   ` Junio C Hamano [this message]
2021-02-24  4:24   ` git format-patch lost the last part when branch merge Elijah Newren
2021-02-24  4:50     ` Jeff King

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=xmqqzgzv65y6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=wangyugui@e16-tech.com \
    --subject='Re: git format-patch lost the last part when branch merge' \
    /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

Code repositories for project(s) associated with this 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).