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

Re: [PATCH v3 3/4] format-patch: introduce --base=auto option

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 5, 2016, 07:21 UTC
Message-ID
<xmqqk2kc34i6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160405063609.GB10110@yexl-desktop>
Ye Xiaolong <xiaolong.ye@intel.com> writes:
Show 10 quoted lines
>       ---1---o---A
>      /    \ /
>  ---O      X
>      \    / \
>       ---2---o---o---B
>
> For this criss-cross merges, as neither merge base(like 1) is better
> than the other(both 1 and 2 are 'best' merge bases), I think it should
> be fine to pick a random one as base commit(Or you prefer to show all of
> them?) and I'll add this part of discusstion into documentation.

I think you should error out; it would give you blatantly wrong to pick either one at random.

Suppose A is where your remote-tracking branch is, and B is where the user started working on her serie. We are sending patches built on top of B (not depicted) with "format-patch --base=A B..".

If you picked '1' as the base, you'll include commits on the === stretch as prerequisite patches (think of any non-merge --o-- in the picture to consist of multiple commits), but you won't be showing what the merge 'M' between '1' and '2' did to the tree of '1' to arrive at the resulting tree of 'M'.

       ---1---o---A
      /    \ /
  ---O      X
      \    / \
       ---2---M===o===B...your.patches.here...

If you picked '2' as the base, you'll include commits on the === stretch as prerequisite patches, but again you won't be showing what the merge 'M' between '1' and '2' did to the tree of '2' to arrive at the resulting tree of 'M'..

       ---1---o---A
      /    \ /
  ---O      X
      \    / \
       ---2===M===o===B...your.patches.here...

So either case, you cannot rebuild the tree of B by going from the base and piling on patches in such a case, because you won't have "patch" for merge 'M'.

Previous: Ye XiaolongNext: Xiaolong Ye
Message 14 of 16 in “Add an option to git-format-patch to record base tree info”
  1. 0/4 Add an option to git-format-patch to record base tree infoXiaolong Ye, Mar 31, 2016
  2. 1/4 patch-ids: make commit_patch_id() a public helper functionXiaolong Ye, Mar 31, 2016
  3. 2/4 format-patch: add '--base' option to record base tree infoXiaolong Ye, Mar 31, 2016
  4. Junio C HamanoMar 31, 2016
  5. Ye XiaolongApr 1, 2016
  6. Junio C HamanoApr 1, 2016
  7. Ye XiaolongApr 5, 2016
  8. Ye XiaolongApr 9, 2016
  9. 3/4 format-patch: introduce --base=auto optionXiaolong Ye, Mar 31, 2016
  10. Junio C HamanoMar 31, 2016
  11. Ye XiaolongApr 1, 2016
  12. Junio C HamanoApr 1, 2016
  13. Ye XiaolongApr 5, 2016
  14. Junio C HamanoApr 5, 2016
  15. 4/4 format-patch: introduce format.base configurationXiaolong Ye, Mar 31, 2016
  16. Junio C HamanoMar 31, 2016

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.