From: FanJun Kong <bh1scw@gmail.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: git@vger.kernel.org
Subject: Re: help for git format-patch lost diffstat
Date: Mon, 25 Apr 2022 17:45:50 +0800 [thread overview]
Message-ID: <20220425094550.e6vw6xwtk4dcstyd@kong-HP> (raw)
In-Reply-To: <CAPig+cQsGZ5Uw13vr5r_SZ9APZwovtxSW5N4QGpieHRx1_6zRg@mail.gmail.com>
On 25 Apr 22 ◦ 04:09, Eric Sunshine wrote:
> On Sun, Apr 24, 2022 at 9:00 AM FanJun Kong <bh1scw@gmail.com> wrote:
> > First, I created two commits to a demo project.
> >
> > when I use command:
> > git format-patch --cover-letter -1
> > [...]
> > FanJun Kong (1):
> > First commit.
> > 1.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > ok, you can see the cover letter has diffstat, just above "--".
> >
> > git format-patch --cover-letter -2
> > [...]
> > FanJun Kong (2):
> > First commit.
> > Second commit.
> >
> > Comparing with last command, I just want to get 2 patches,
> > but this time the diffstat is missing.
> >
> > I am not sure if this is a bug or I miss some options.
>
> This is expected behavior according to this code in
> make_cover_letter() in builtin/log.c:
>
> /* We can only do diffstat with a unique reference point */
> if (origin)
> show_diffstat(rev, origin, head);
>
> The problem is that when you format both patches of a two-commit
> repository, `origin` is NULL because there is no commit preceding the
> initial commit; the initial commit is the root of the history. Thus,
> there is nothing prior to the first patch against which to create a
> diffstat.
>
Very clear explanation, yeah~
> I have not investigated, but it may be possible to teach
> show_diffstat() how to generate a diffstat against the "emptiness"
> preceding the initial commit, but nobody has done so yet. Perhaps this
> would be a good project for someone interested in contributing to the
> project (or perhaps not -- as mentioned, I haven't investigated how
> hard this would be).
From my point of view, it is a bug, but it doesn't affect too much.
I agree with your suggestion, this is a nice chance to learn how
to submit patches to upstream.
next prev parent reply other threads:[~2022-04-25 9:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-24 6:41 help for git format-patch lost diffstat FanJun Kong
2022-04-24 6:47 ` FanJun Kong
2022-04-25 8:09 ` Eric Sunshine
2022-04-25 9:45 ` FanJun Kong [this message]
2022-04-25 17:25 ` Junio C Hamano
2022-04-25 8:14 ` Junio C Hamano
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=20220425094550.e6vw6xwtk4dcstyd@kong-HP \
--to=bh1scw@gmail.com \
--cc=git@vger.kernel.org \
--cc=sunshine@sunshineco.com \
/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).