Skip to content

Commit dedeeeb

Browse files
pabloosabaterrgitster
authored andcommitted
graph: add documentation and tests about --graph-lane-limit
Document --graph-lane-limit option in rev-list-options.adoc with --graph option. Add multiple tests in t4215 reusing existing last graph, test for different scenarios. Signed-off-by: Pablo Sabater <pabloosabaterr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 631bc59 commit dedeeeb

2 files changed

Lines changed: 150 additions & 0 deletions

File tree

Documentation/rev-list-options.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,12 @@ This implies the `--topo-order` option by default, but the
12591259
in between them in that case. If _<barrier>_ is specified, it
12601260
is the string that will be shown instead of the default one.
12611261

1262+
`--graph-lane-limit=<n>`::
1263+
When `--graph` is used, limit the number of graph lanes to be shown.
1264+
Lanes over the limit are replaced with a truncation mark '~'. By default
1265+
it is set to 0 (no limit), zero and negative values are ignored and
1266+
treated as no limit.
1267+
12621268
ifdef::git-rev-list[]
12631269
`--count`::
12641270
Print a number stating how many commits would have been

t/t4215-log-skewed-merges.sh

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,148 @@ test_expect_success 'log --graph with multiple tips' '
370370
EOF
371371
'
372372

373+
test_expect_success 'log --graph --graph-lane-limit=2 limited to two lanes' '
374+
check_graph --graph-lane-limit=2 M_7 <<-\EOF
375+
*-. 7_M4
376+
|\ \
377+
| | * 7_G
378+
| | * 7_F
379+
| * ~ 7_E
380+
| * ~ 7_D
381+
* | ~ 7_C
382+
| |/
383+
|/|
384+
* | 7_B
385+
|/
386+
* 7_A
387+
EOF
388+
'
389+
390+
test_expect_success 'log --graph --graph-lane-limit=1 truncate mid octopus merge' '
391+
check_graph --graph-lane-limit=1 M_7 <<-\EOF
392+
*-~ 7_M4
393+
|\~
394+
| ~ 7_G
395+
| ~ 7_F
396+
| * 7_E
397+
| * 7_D
398+
* ~ 7_C
399+
| ~
400+
|/~
401+
* ~ 7_B
402+
|/
403+
* 7_A
404+
EOF
405+
'
406+
407+
test_expect_success 'log --graph --graph-lane-limit=3 limited to three lanes' '
408+
check_graph --graph-lane-limit=3 M_1 M_3 M_5 M_7 <<-\EOF
409+
* 7_M1
410+
|\
411+
| | * 7_M2
412+
| | |\
413+
| | | * 7_H
414+
| | | ~ 7_M3
415+
| | | ~ 7_J
416+
| | | ~ 7_I
417+
| | | ~ 7_M4
418+
| |_|_~
419+
|/| | ~
420+
| | |_~
421+
| |/| ~
422+
| | | ~
423+
| | |/~
424+
| | * ~ 7_G
425+
| | | ~
426+
| | |/~
427+
| | * ~ 7_F
428+
| * | ~ 7_E
429+
| | |/~
430+
| |/| ~
431+
| * | ~ 7_D
432+
| | |/
433+
| |/|
434+
* | | 7_C
435+
| |/
436+
|/|
437+
* | 7_B
438+
|/
439+
* 7_A
440+
EOF
441+
'
442+
443+
test_expect_success 'log --graph --graph-lane-limit=6 check if it only shows first of 3 parent merge' '
444+
check_graph --graph-lane-limit=6 M_1 M_3 M_5 M_7 <<-\EOF
445+
* 7_M1
446+
|\
447+
| | * 7_M2
448+
| | |\
449+
| | | * 7_H
450+
| | | | * 7_M3
451+
| | | | |\
452+
| | | | | * 7_J
453+
| | | | * | 7_I
454+
| | | | | | * 7_M4
455+
| |_|_|_|_|/~
456+
|/| | | | |/~
457+
| | |_|_|/| ~
458+
| |/| | | |/
459+
| | | |_|/|
460+
| | |/| | |
461+
| | * | | | 7_G
462+
| | | |_|/
463+
| | |/| |
464+
| | * | | 7_F
465+
| * | | | 7_E
466+
| | |/ /
467+
| |/| |
468+
| * | | 7_D
469+
| | |/
470+
| |/|
471+
* | | 7_C
472+
| |/
473+
|/|
474+
* | 7_B
475+
|/
476+
* 7_A
477+
EOF
478+
'
479+
480+
test_expect_success 'log --graph --graph-lane-limit=7 check if it shows all 3 parent merge' '
481+
check_graph --graph-lane-limit=7 M_1 M_3 M_5 M_7 <<-\EOF
482+
* 7_M1
483+
|\
484+
| | * 7_M2
485+
| | |\
486+
| | | * 7_H
487+
| | | | * 7_M3
488+
| | | | |\
489+
| | | | | * 7_J
490+
| | | | * | 7_I
491+
| | | | | | * 7_M4
492+
| |_|_|_|_|/|\
493+
|/| | | | |/ /
494+
| | |_|_|/| /
495+
| |/| | | |/
496+
| | | |_|/|
497+
| | |/| | |
498+
| | * | | | 7_G
499+
| | | |_|/
500+
| | |/| |
501+
| | * | | 7_F
502+
| * | | | 7_E
503+
| | |/ /
504+
| |/| |
505+
| * | | 7_D
506+
| | |/
507+
| |/|
508+
* | | 7_C
509+
| |/
510+
|/|
511+
* | 7_B
512+
|/
513+
* 7_A
514+
EOF
515+
'
516+
373517
test_done

0 commit comments

Comments
 (0)