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

Re: [PATCH 1/2] revision: Denote root commits with '#'

From
KMKyle Marek <kmarek@pdinc.us>
Date
Jan 18, 2021, 07:56 UTC
Message-ID
<e0264a29-2112-f8c8-f066-2be445654d8e@pdinc.us>
In-Reply-To
<xmqq7dobmfrq.fsf@gitster.c.googlers.com>
On 1/17/21 4:10 PM, Junio C Hamano wrote:
Show 10 quoted lines
> Kyle Marek<kmarek@pdinc.us>  writes:
>
>> This aids in identifying where an unrelated branch history starts when
>> using `git log --graph --oneline --all`
>>
>> Signed-off-by: Kyle Marek<kmarek@pdinc.us>
>> ---
>>   revision.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
> No tests?
I'm not very familiar with the code base. I now see the t/README file.
Show 30 quoted lines
>> diff --git a/revision.c b/revision.c
>> index 9dff845bed..8556923de8 100644
>> --- a/revision.c
>> +++ b/revision.c
>> @@ -4191,9 +4191,11 @@ const char *get_revision_mark(const struct rev_info *revs, const struct commit *
>>   			return "<";
>>   		else
>>   			return ">";
>> -	} else if (revs->graph)
>> +	} else if (revs->graph) {
>> +		if (!commit->parents)
>> +			return "#";
>>   		return "*";
>> -	else if (revs->cherry_mark)
>> +	} else if (revs->cherry_mark)
>>   		return "+";
>>   	return "";
>>   }
> Here is what I tried to come up with, but somehow the "#" marker is
> not showing for me.
>
> The "counted plus --left-right" tests stress why a single "#" is not
> good enough.  I think the patch also needs to replace "<" and ">"
> for root commits that are left and right---in the tests, I used "L"
> to denote "root that is on the left side" (and "R" for the right
> side) instead of single "#", so that we do not to lose information.
>
> By the way, as I already said in the original thread, I do not think
> the '#' marking is a good idea; I'd rather see the root commit shown
> by shifting columns.

Sorry, I wasn't subscribed to the list until Jason CC'd me on his request. I also wasn't aware of --left-right.

I'll investigate the revision-mark shifting idea. I am concerned that it would get complicated if a graph edge extends around a revision that needs to be shifted, but I'm finding it difficult to produce this with --graph:

*   8d82d0a (HEAD -> master) Merge branch 'o1'
|\
| * 3479914 (o1) O1
| * a674e07 O1        <-- root commit
| * 2237b52 (t) T
| * f525fa5 T
|/
* f15f936 A
| * 9e289ed (u) U
|/
* ee911c8 initial     <-- root commit
vs:
*   8ee9b14 (HEAD -> master) Merge branch 'u'
|\
| * ed1990f (u) U
* |   277f31c Merge branch 'o1'
|\ \
| * | eaa71bb (o1) O1
| * | 9203a43 O1      <-- root commit
|  /
| | * bc2c4d9 (t) T
| | * 2d3c03b T
| |/
|/|
* | 6a26183 A
|/
* da85ccf initial     <-- root commit
  
Thoughts? Will git ever graph something like:
*
|\
| *
* |
|\ \
| * | <-- root commit
| * | <-- some head
|/ /
* /
|/
*     <-- root commit
-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Kyle Marek                        PD Inc.http://www.pdinc.us  -
- Jr. Developer                     10 West 24th Street #100    -
- +1 (443) 269-1555 x361            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 29 in “add a blank line when a commit has no parent in log output?”
  1. Jason PyeronJan 14, 2021
  2. Philippe BlainJan 14, 2021
  3. Jason PyeronJan 14, 2021
  4. 0/2 Option to modify revision mark for root commitsKyle Marek, Jan 17, 2021
  5. 1/2 revision: Denote root commits with '#'Kyle Marek, Jan 17, 2021
  6. Junio C HamanoJan 17, 2021
  7. Kyle MarekJan 18, 2021
  8. Junio C HamanoJan 18, 2021
  9. Junio C HamanoJan 18, 2021
  10. Kyle MarekJan 19, 2021
  11. Junio C HamanoJan 19, 2021
  12. Kyle MarekJan 20, 2021
  13. Junio C HamanoJan 20, 2021
  14. Jason PyeronJan 20, 2021
  15. Junio C HamanoJan 20, 2021
  16. Jason PyeronJan 20, 2021
  17. Junio C HamanoJan 23, 2021
  18. Jason PyeronJan 23, 2021
  19. Junio C HamanoJan 23, 2021
  20. Jason PyeronJan 24, 2021
  21. Junio C HamanoJan 25, 2021
  22. Junio C HamanoJan 17, 2021
  23. 2/2 revision: implement --show-linear-break for --graphKyle Marek, Jan 17, 2021
  24. Junio C HamanoJan 17, 2021
  25. Junio C HamanoJan 18, 2021
  26. Kyle MarekJan 18, 2021
  27. Junio C HamanoJan 18, 2021
  28. Kyle MarekJan 19, 2021
  29. Junio C HamanoJan 15, 2021

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.