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

Re: [PATCH] patch-id: Add support for mbox format

From
Paolo Bonzini <bonzini@gnu.org>
Date
Apr 16, 2010, 21:52 UTC
Message-ID
<4BC8DC0F.5010007@gnu.org>
In-Reply-To
<7vochjay8a.fsf@alter.siamese.dyndns.org>
On 04/16/2010 11:23 PM, Junio C Hamano wrote:
Show 15 quoted lines
>>>>   I have an alias that takes two arguments and compares their patch IDs.
>>>>   I would like to use to make sure I've tested exactly what I submit
>>>>   (patch by patch), like
>>>>
>>>>       git patch-cmp origin/master.. file-being-sent
>>>> ...
>>>
>>> I somehow have a feeling that this is solving a wrong problem.
>>
>> In what sense?
>
> Why does file-being-sent have anything from origin/master to begin with?
> Perhaps the --ignore-if-in-upstream mechanism needs to be updated so that
> you won't have duplicates that patch-id could easily find in the first
> place?

I think we're speaking about different things, --ignore-if-in-upstream doesn't have anything to do with this. The git patch-cmp alias is just checking that

   git show origin/master.. | git patch-id | tac | awk '{print $1}'
and
   git patch-id < file-being-sent | awk '{print $1}'
produce the exact same output.

I use this when I had to edit the file-being-sent, e.g. to add cover letters or an introduction to a patch series. Since some time passes between format-patch and send-email, I want to test that the file I'm sending is exactly what I have in the repository, and that I'm not submitting the wrong series.

Alternatively, I could apply file-being-sent to a detached HEAD and compare the trees, like

   topic=`git rev-parse HEAD`
   git checkout origin/master
   git am file-being-sent || echo bad
   mine=HEAD
   for i in `git rev-list origin/master..$topic`; do
     git diff-tree $i $mine || echo bad
     mine=${mine}^
   done

However, comparing the patch-id is faster and perfect for this job. What were your intended uses for the git-patch-id utility?

Paolo
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 11 in “patch-id: Add support for mbox format”
  1. patch-id: Add support for mbox formatPaolo Bonzini, Apr 16, 2010
  2. Junio C HamanoApr 16, 2010
  3. Paolo BonziniApr 16, 2010
  4. Junio C HamanoApr 16, 2010
  5. Paolo BonziniApr 16, 2010
  6. Junio C HamanoApr 17, 2010
  7. 1/2 patch-id: extract parsing one diff out of generate_id_listPaolo Bonzini, Apr 19, 2010
  8. 2/2 patch-id: Add support for mbox formatPaolo Bonzini, Apr 19, 2010
  9. Junio C HamanoApr 19, 2010
  10. Paolo BonziniApr 20, 2010
  11. Junio C HamanoApr 20, 2010

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.