From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: git@vger.kernel.org
Cc: Eric Sunshine <sunshine@sunshineco.com>
Subject: git format-patch --range-diff bug?
Date: Thu, 12 Nov 2020 18:43:53 +0100 [thread overview]
Message-ID: <20201112174353.GD4270@szeder.dev> (raw)
I've just run into an unexpected looking range-diff generated by 'git
format-patch -1 --range-diff=...'. While the 'git range-diff' command
correctly pairs up the old and new versions of the commit, 'git
format-patch --range-diff' somehow doesn't and reports it in a weird
way.
The test below demonstrates the issue, though it doesn't fail but only
prints the outputs of those commands:
--- >8 ---
#!/bin/sh
test_description='test'
. ./test-lib.sh
test_expect_success 'test' '
test_tick &&
printf "%s\n" 0 1 2 3 4 5 6 7 8 9 >file &&
git add file &&
git commit -m initial &&
git checkout -b v1 &&
echo foo >>file &&
git commit -m change file &&
git checkout -b v2 master &&
echo bar >>file &&
git commit -m change file &&
: The output of the range-diff command is what I would expect to be included in the generated patch &&
git range-diff v1...v2 &&
: But that is not what we get embedded in the generated patch &&
git format-patch -1 --range-diff=v1...v2 v2 &&
sed -n -e "/^Range-diff:$/,/^$/ p" 0001-change.patch &&
: Adding the range-diff to the cover letter doesnt seem to help &&
git format-patch -1 --range-diff=v1...v2 --cover-letter v2 &&
sed -n -e "/^Range-diff:$/,$ p" 0000-cover-letter.patch
'
test_done
--- 8< ---
And here is the relevant part of the output:
+ : The output of the range-diff command is what I would expect to be
included in the generated patch
+ git range-diff v1...v2
1: f8c2d0b ! 1: 83c34a8 change
@@ -9,4 +9,4 @@
7
8
9
-+foo
++bar
+ : But that is not what we get embedded in the generated patch
+ git format-patch -1 --range-diff=v1...v2 v2
0001-change.patch
+ sed -n -e /^Range-diff:$/,/^$/ p 0001-change.patch
Range-diff:
1: 83c34a8 = 1: 83c34a8 change
2: f8c2d0b < -: ------- change
+ : Adding the range-diff to the cover letter doesnt seem to help
+ git format-patch -1 --range-diff=v1...v2 --cover-letter v2
0000-cover-letter.patch
0001-change.patch
+ sed -n -e /^Range-diff:$/,$ p 0000-cover-letter.patch
Range-diff:
1: 83c34a8 = 1: 83c34a8 change
2: f8c2d0b < -: ------- change
--
2.18.0.584.g40ce41604d
next reply other threads:[~2020-11-12 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 17:43 SZEDER Gábor [this message]
2020-11-12 17:57 ` git format-patch --range-diff bug? Junio C Hamano
2020-11-12 18:32 ` Eric Sunshine
2020-11-12 18:59 ` Junio C Hamano
2020-11-12 20:06 ` Eric Sunshine
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=20201112174353.GD4270@szeder.dev \
--to=szeder.dev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.