diff mbox series

[v4,6/6] builtin: patch-id: remove unused diff-tree prefix

Message ID dcdfac7a1539103926dd46e8c3d5c10fe640c0f3.1666307815.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Commit ec35a3382f397b0020f39365a75522ff41a09cfe
Headers show
Series patch-id fixes and improvements | expand

Commit Message

Jerry Zhang Oct. 20, 2022, 11:16 p.m. UTC
From: Jerry Zhang <Jerry@skydio.com>

From a "git grep" of the repo, no command, including diff-tree itself,
produces diff output with "diff-tree " prefixed in the header.

Thus remove its handling in "patch-id".

Signed-off-by: Jerry Zhang <Jerry@skydio.com>
---
 builtin/patch-id.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Junio C Hamano Oct. 21, 2022, 9:33 a.m. UTC | #1
"Jerry Zhang via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Jerry Zhang <Jerry@skydio.com>
>
> From a "git grep" of the repo, no command, including diff-tree itself,
> produces diff output with "diff-tree " prefixed in the header.
>
> Thus remove its handling in "patch-id".

There is a bit of leap in the logic flow here, in that the current
state alone does not justify such a removal of the code that is not
hurting anybody.  I thought I did the necessary homework the last
time to help you update the proposed log message for this step with
necessary due diligence, like when we stopped producing it
ourselves.  The lack of third-party tools still relying on the code
we are removing here is not something we can prove easily, so
documenting that we go by faith there would not hurt, either.
diff mbox series

Patch

diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index afdd472369f..f840fbf1c7e 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -74,8 +74,8 @@  static int get_one_patchid(struct object_id *next_oid, struct object_id *result,
 		const char *p = line;
 		int len;
 
-		if (!skip_prefix(line, "diff-tree ", &p) &&
-		    !skip_prefix(line, "commit ", &p) &&
+		/* Possibly skip over the prefix added by "log" or "format-patch" */
+		if (!skip_prefix(line, "commit ", &p) &&
 		    !skip_prefix(line, "From ", &p) &&
 		    starts_with(line, "\\ ") && 12 < strlen(line)) {
 			if (verbatim)