Subject: Re: help for git format-patch lost diffstat

From: Junio C Hamano <[email-masked]>
Date: Mon, 25 Apr 2022 01:14:04 -0700

FanJun Kong <[email-masked]> writes:

> First, I created two commits to a demo project.
>
> when I use command:
> git format-patch --cover-letter -1
> ...
> Then I change command to:
>
> git format-patch --cover-letter -2

Here is _one_ way I just came up with, that gives you a result
identical to what you reported, and it is a perfectly understandable
and expected outcome in _this_ scenario.

Preparation goes like this.  Go to any single-parent commit and
revert it.

  $ git checkout --detach seen^2
  $ GIT_EDITOR=: git revert HEAD

Now we have two commits.  Try formatting the topmost one:

  $ git format-patch --stdout --cover-letter -1 |
    sed -e "1,/^$/d" -e "/^-- /q"
  *** BLURB HERE ***

  Junio C Hamano (1):
    Revert "ci: call `finalize_test_case_output` a little later"

   t/test-lib.sh | 11 +++++------
   1 file changed, 5 insertions(+), 6 deletions(-)

  -- 

Now try formatting the twomost two:

  $ git format-patch --stdout --cover-letter -2 |
    sed -e "1,/^$/d" -e "/^-- /q"
  *** BLURB HERE ***

  Johannes Schindelin (1):
    ci: call `finalize_test_case_output` a little later

  Junio C Hamano (1):
    Revert "ci: call `finalize_test_case_output` a little later"

  -- 

The topmost commit had some effect on a single file, but when the
effect of two topmost commits are taken together, they cancel out.

I am not saying these two commits are what you have, but the outcome
obviously depends on what these two commits are, and if you do not
show them, nobody would be able to help you.