Re: [PATCH 1/2] revision: Denote root commits with '#'
- From
- Kyle 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 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-