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

Re: [PATCH] revision: --include-diversions adds helpful merges

From
Derrick Stolee <stolee@gmail.com>
Date
Apr 8, 2020, 15:28 UTC
Message-ID
<74562b04-b1ce-cad4-da18-4af030a3dc29@gmail.com>
In-Reply-To
<5f1c6868-303c-ccc1-553e-e54d0fa8e24f@gmail.com>
On 4/7/2020 9:39 PM, Derrick Stolee wrote:
Show 7 quoted lines
> On 4/7/2020 9:30 PM, Junio C Hamano wrote:
>> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
>>
>>>     This --include-diversions option could use a better name.
>>
>> True, but I do not think of a better (or for that matter a worse)
>> one.  
Here are some alternative names:
	--audit-merges
	--audit-trunk
	--first-merges
	--subtle-merges
	--more-merges

The "audit" name implies some of the intent: we are trying to audit which merge commits introduced these changes. The --audit-trunk implies we are using a trunk-based workflow where parent order is critical. However, "trunk" may be confusing when there are multiple long-lived branches.

A "first merge" is confusing when we see a sequence of multiple diversion merges (I include a test with this exact situation in my next version.)

"subtle" is a bit wishy-washy.

"--more-merges" is not very specific. The way we are adding merges to the final result may not be the only way we want to add "more" merges in the future.

So, I think "--audit-merges" is the best of these alternatives. I'd be happy to be overruled with a different option. Hopefully, these options inspire better ideas from the community.

Show 23 quoted lines
>> As a new feature, I think this is a reasonable thing to want,
>> especially it is in line with the push in the past few years to
>> treat the first parent history specially.
>>
>> I wonder how this would interact with the ancestry-path option?
>> That one also, like the simplify-merges option, needs a limited
>> traversal, and if this new mode can do without a limited traversal
>> (in other words, the output can be done incrementally from the tip)
>> and achieve something similar to what these other options wanted to
>> show, that would be great.
> 
> You're right. I briefly considered the --ancestry-path option before
> realizing that would get a huge set of commits (for example: every
> topic based on the branch after the pull request was merged).
> 
> The --include-diversions works incrementally like simplified merges.
> Based on the implementation, it would not change the results when
> added to a --full-history query. This makes sense: a diversion would
> appear in the --full-history results, anyway.
> 
> It is worth adding tests for the combination with --ancestry-path
> and --simplify-merges, as the --include-diversions option would
> add results to those queries.

My gitgitgadget PR [1] is updated with tests and some new logic to handle the new option along with --simplify-merges. The situation was a bit subtle, so my next version will include a significant update to the rev-list documentation under the "History Simplification" mode.

I'll give things some time to calm on the name of the option before sending a v2.

My v2 also includes adding a new object flag "DIVERSION" to track these commits from the TREESAME calculation through the simplify-merges logic. When I was adding a new flag, I realized that I already messed up the 32-bit alignment of "struct object" when adding the TOPO_ORDER flags. The parsed, type, and flags bitfields add up to 33 bits!

A solution would include pulling the TOPO_ORDER_* flags to be bits 22 and 23 instead of 26 and 27, but that would collide with what is happening in builtin/show-branch.c. But then I saw the following comment in builtin/show-branch.c:

/*
 * TODO: convert this use of commit->object.flags to commit-slab
 * instead to store a pointer to ref name directly. Then use the same
 * UNINTERESTING definition from revision.h here.
 */

Is anyone interested in tackling this problem? I don't see any test failures when I swap the TOPO_ORDER_ flag locations, but that might just mean that show-branch isn't tested enough.

Thanks, -Stolee

[1] https://github.com/gitgitgadget/git/pull/599
Previous: Derrick StoleeNext: Junio C Hamano
Message 4 of 23 in “revision: --include-diversions adds helpful merges”
  1. revision: --include-diversions adds helpful mergesDerrick Stolee via GitGitGadget, Apr 8, 2020
  2. Junio C HamanoApr 8, 2020
  3. Derrick StoleeApr 8, 2020
  4. Derrick StoleeApr 8, 2020
  5. Junio C HamanoApr 8, 2020
  6. Jeff KingApr 8, 2020
  7. Derrick StoleeApr 8, 2020
  8. Junio C HamanoApr 8, 2020
  9. Derrick StoleeApr 8, 2020
  10. Junio C HamanoApr 9, 2020
  11. Derrick StoleeApr 9, 2020
  12. Philip OakleyApr 9, 2020
  13. Junio C HamanoApr 9, 2020
  14. Derrick StoleeApr 9, 2020
  15. Jeff KingApr 9, 2020
  16. Junio C HamanoApr 9, 2020
  17. Jeff KingApr 9, 2020
  18. brian m. carlsonApr 8, 2020
  19. Jeff KingApr 8, 2020
  20. revision: --include-diversions adds helpful mergesDerrick Stolee via GitGitGadget, Apr 9, 2020
  21. revision: --show-pulls adds helpful mergesDerrick Stolee via GitGitGadget, Apr 10, 2020
  22. Junio C HamanoApr 10, 2020
  23. Derrick StoleeApr 10, 2020

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.