From: Stephen Boyd <sboyd@kernel.org>
To: git@vger.kernel.org
Cc: Xiaolong Ye <xiaolong.ye@intel.com>
Subject: [PATCH 1/2] format-patch: Inform user that patch-id generation is unstable
Date: Fri, 26 Apr 2019 16:51:56 -0700 [thread overview]
Message-ID: <20190426235157.106350-1-sboyd@kernel.org> (raw)
I tried out 'git format-patch --base' with a set of commits that
modifies more than one file. It turns out that the way this command is
implemented it actually uses the unstable version of patch-id instead of
the stable version that's documented. When I tried to modify the
existing test to use 'git patch-id --stable' vs. 'git patch-id
--unstable' I found that it didn't matter, the test still passed.
Let's expand on the test here so it is a little more complicated and
then use that to show that the patch-id generation is actually unstable
vs. stable. Update the documentation as well.
Cc: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
Documentation/git-format-patch.txt | 2 +-
t/t4014-format-patch.sh | 36 +++++++++++++++++++++++++-----
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 1af85d404f51..e8cc792e7f5d 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -583,7 +583,7 @@ of 'base commit' in topological order before the patches can be applied.
The 'base commit' is shown as "base-commit: " followed by the 40-hex of
the commit object name. A 'prerequisite patch' is shown as
"prerequisite-patch-id: " followed by the 40-hex 'patch id', which can
-be obtained by passing the patch through the `git patch-id --stable`
+be obtained by passing the patch through the `git patch-id --unstable`
command.
Imagine that on top of the public commit P, you applied well-known
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index b6e2fdbc4410..e82c6c7d9177 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -36,8 +36,27 @@ test_expect_success setup '
git checkout master &&
git diff-tree -p C2 | git apply --index &&
test_tick &&
- git commit -m "Master accepts moral equivalent of #2"
+ git commit -m "Master accepts moral equivalent of #2" &&
+ git checkout side &&
+ git checkout -b patchid &&
+ for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file2 &&
+ for i in 1 2 3 A 4 B C 7 8 9 10 D E F 5 6; do echo "$i"; done >file3 &&
+ for i in 8 9 10; do echo "$i"; done >file &&
+ git add file file2 file3 &&
+ test_tick &&
+ git commit -m "patchid 1" &&
+ for i in 4 A B 7 8 9 10; do echo "$i"; done >file2 &&
+ for i in 8 9 10 5 6; do echo "$i"; done >file3 &&
+ git add file2 file3 &&
+ test_tick &&
+ git commit -m "patchid 2" &&
+ for i in 10 5 6; do echo "$i"; done >file &&
+ git add file &&
+ test_tick &&
+ git commit -m "patchid 3" &&
+
+ git checkout master
'
test_expect_success "format-patch --ignore-if-in-upstream" '
@@ -1559,16 +1578,23 @@ test_expect_success 'format-patch -o overrides format.outputDirectory' '
'
test_expect_success 'format-patch --base' '
- git checkout side &&
+ git checkout patchid &&
git format-patch --stdout --base=HEAD~3 -1 | tail -n 7 >actual1 &&
git format-patch --stdout --base=HEAD~3 HEAD~.. | tail -n 7 >actual2 &&
echo >expected &&
echo "base-commit: $(git rev-parse HEAD~3)" >>expected &&
- echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --stable | awk "{print \$1}")" >>expected &&
- echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --stable | awk "{print \$1}")" >>expected &&
+ echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --unstable | awk "{print \$1}")" >>expected &&
+ echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --unstable | awk "{print \$1}")" >>expected &&
signature >> expected &&
test_cmp expected actual1 &&
- test_cmp expected actual2
+ test_cmp expected actual2 &&
+ echo >fail &&
+ echo "base-commit: $(git rev-parse HEAD~3)" >>fail &&
+ echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --stable | awk "{print \$1}")" >>fail &&
+ echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --stable | awk "{print \$1}")" >>fail &&
+ signature >> fail &&
+ ! test_cmp fail actual1 &&
+ ! test_cmp fail actual2
'
test_expect_success 'format-patch --base errors out when base commit is in revision list' '
--
Sent by a computer through tubes
next reply other threads:[~2019-04-26 23:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 23:51 Stephen Boyd [this message]
2019-04-26 23:51 ` [PATCH 2/2] format-patch: Make --base patch-id output stable Stephen Boyd
2019-05-07 4:38 ` Junio C Hamano
2019-05-07 17:46 ` Stephen Boyd
2019-05-08 2:56 ` 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=20190426235157.106350-1-sboyd@kernel.org \
--to=sboyd@kernel.org \
--cc=git@vger.kernel.org \
--cc=xiaolong.ye@intel.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.