git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: RFE: git-patch-id should handle patches without leading "diff"

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 7, 2018, 22:34 UTC
Message-ID
<20181207223406.GD73340@google.com>
In-Reply-To
<87tvjpx9fy.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
> On Fri, Dec 07 2018, Jonathan Nieder wrote:
Show 6 quoted lines
>> The patch-id appears to only care about the diff text, so it should be
>> able to handle this.  So if we have a better heuristic for where the
>> diff starts, it would be good to use it.
>
> No, the patch-id doesn't just care about the diff, it cares about the
> context before the diff too.

Sorry, I did a bad job of communicating. When I said "diff text", I was including context.

[...]
Show 8 quoted lines
> Observe that the diff --git line matters, we hash it:
>
>     $ git diff-tree -p HEAD~.. | git patch-id
>     5870d115b7e2a9a936ab8fdc254932234413c710 0000000000000000000000000000000000000000
>     $ git diff-tree --src-prefix=a/ --dst-prefix=b/ -p HEAD~.. | git patch-id --stable
>     5870d115b7e2a9a936ab8fdc254932234413c710 0000000000000000000000000000000000000000
>     $ git diff-tree --src-prefix=x/ --dst-prefix=y/ -p HEAD~.. | git patch-id --stable
>     4cd136f2b98760150f700ac6a5b126389d6d05a7 0000000000000000000000000000000000000000
Oh, hm.  That's unfortunate.
[...]
Show 11 quoted lines
> So it seems most sensible to me if this is going to be supported that we
> go a bit beyond the call of duty and fake up the start of it, namely:
>
>     --- a/arch/x86/kernel/process.c
>     +++ b/arch/x86/kernel/process.c
>
> To be:
>
>     diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
>     --- a/arch/x86/kernel/process.c
>     +++ b/arch/x86/kernel/process.c
Right.  We may want to handle diff.mnemonicPrefix as well.
Jonathan
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 5 of 6 in “RFE: git-patch-id should handle patches without leading "diff"”
  1. Konstantin RyabitsevDec 7, 2018
  2. Ævar Arnfjörð BjarmasonDec 7, 2018
  3. Jonathan NiederDec 7, 2018
  4. Ævar Arnfjörð BjarmasonDec 7, 2018
  5. Jonathan NiederDec 7, 2018
  6. Junio C HamanoDec 8, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.