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 1, 2016, 16:06 UTC
Message-ID
<xmqqlh4xjoub.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160401135207.GB2915@yexl-desktop>
Ye Xiaolong <xiaolong.ye@intel.com> writes:
Show 11 quoted lines
> On Thu, Mar 31, 2016 at 10:43:48AM -0700, Junio C Hamano wrote:
>>Xiaolong Ye <xiaolong.ye@intel.com> writes:
>>
>>> Introduce --base=auto to record the base commit info automatically, the base_commit
>>> will be the merge base of tip commit of the upstream branch and revision-range
>>> specified in cmdline.
>>
>>This line is probably a bit too long.
>
> How about simplifying it to "the base_commit is the merge base of upstream and
> specified revision-range."?

What I meant was not that profound. I just wanted you to wrap your lines a bit shorter so that quoting in the discussion thread like this would not make the result overlong to fit on a 80-column terminal ;-)

Show 11 quoted lines
>>> +			base = base_list->item;
>>> +			free_commit_list(base_list);
>>
>>What should happen when there are multiple merge bases?  The code
>>picks one at random and ignores the remainder, if I am reading this
>>correctly.
>
> If there is more than one merge base, commits in base_list should
> be sorted by date, if I am understanding it correctly, so
> base_list->item should be the lastest merge base commit, it should
> be enough for us to used as base commit.

By definition, when there are multiple merge bases, there is no latest one among them.

When the history involves criss-cross merges, there can be more than one 'best' common ancestor for two commits. For example, with this topology (note that X is not a commit; it merely denotes crossing of two lines):

       ---1---o---A
      /    \ /
  ---O      X
      \    / \
       ---2---o---o---B

both '1' and '2' are merge-bases of 'A' and 'B'. And the timestamps on one (be it committer or author timestamp) being later than those of the other do not make it any more suitable than the other one.

Previous: Ye XiaolongNext: Ye Xiaolong
Message 12 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.