Skip to content

Commit e2c5966

Browse files
lucianpostongitster
authored andcommitted
t4202: add test for "log --graph --stat -p" separator lines
Add tests to make sure that the three-dash separator lines appear after the graph ancestry lines, and also the graph ancestry lines are not broken between the diffstat and the patch. Signed-off-by: Lucian Poston <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b18e97c commit e2c5966

File tree

1 file changed

+290
-0
lines changed

1 file changed

+290
-0
lines changed

t/t4202-log.sh

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,4 +516,294 @@ test_expect_success 'show added path under "--follow -M"' '
516516
)
517517
'
518518

519+
cat >expect <<\EOF
520+
* commit COMMIT_OBJECT_NAME
521+
|\ Merge: MERGE_PARENTS
522+
| | Author: A U Thor <[email protected]>
523+
| |
524+
| | Merge HEADS DESCRIPTION
525+
| |
526+
| * commit COMMIT_OBJECT_NAME
527+
| | Author: A U Thor <[email protected]>
528+
| |
529+
| | reach
530+
| | ---
531+
| | reach.t | 1 +
532+
| | 1 file changed, 1 insertion(+)
533+
| |
534+
| | diff --git a/reach.t b/reach.t
535+
| | new file mode 100644
536+
| | index 0000000..10c9591
537+
| | --- /dev/null
538+
| | +++ b/reach.t
539+
| | @@ -0,0 +1 @@
540+
| | +reach
541+
| |
542+
| \
543+
*-. \ commit COMMIT_OBJECT_NAME
544+
|\ \ \ Merge: MERGE_PARENTS
545+
| | | | Author: A U Thor <[email protected]>
546+
| | | |
547+
| | | | Merge HEADS DESCRIPTION
548+
| | | |
549+
| | * | commit COMMIT_OBJECT_NAME
550+
| | |/ Author: A U Thor <[email protected]>
551+
| | |
552+
| | | octopus-b
553+
| | | ---
554+
| | | octopus-b.t | 1 +
555+
| | | 1 file changed, 1 insertion(+)
556+
| | |
557+
| | | diff --git a/octopus-b.t b/octopus-b.t
558+
| | | new file mode 100644
559+
| | | index 0000000..d5fcad0
560+
| | | --- /dev/null
561+
| | | +++ b/octopus-b.t
562+
| | | @@ -0,0 +1 @@
563+
| | | +octopus-b
564+
| | |
565+
| * | commit COMMIT_OBJECT_NAME
566+
| |/ Author: A U Thor <[email protected]>
567+
| |
568+
| | octopus-a
569+
| | ---
570+
| | octopus-a.t | 1 +
571+
| | 1 file changed, 1 insertion(+)
572+
| |
573+
| | diff --git a/octopus-a.t b/octopus-a.t
574+
| | new file mode 100644
575+
| | index 0000000..11ee015
576+
| | --- /dev/null
577+
| | +++ b/octopus-a.t
578+
| | @@ -0,0 +1 @@
579+
| | +octopus-a
580+
| |
581+
* | commit COMMIT_OBJECT_NAME
582+
|/ Author: A U Thor <[email protected]>
583+
|
584+
| seventh
585+
| ---
586+
| seventh.t | 1 +
587+
| 1 file changed, 1 insertion(+)
588+
|
589+
| diff --git a/seventh.t b/seventh.t
590+
| new file mode 100644
591+
| index 0000000..9744ffc
592+
| --- /dev/null
593+
| +++ b/seventh.t
594+
| @@ -0,0 +1 @@
595+
| +seventh
596+
|
597+
* commit COMMIT_OBJECT_NAME
598+
|\ Merge: MERGE_PARENTS
599+
| | Author: A U Thor <[email protected]>
600+
| |
601+
| | Merge branch 'tangle'
602+
| |
603+
| * commit COMMIT_OBJECT_NAME
604+
| |\ Merge: MERGE_PARENTS
605+
| | | Author: A U Thor <[email protected]>
606+
| | |
607+
| | | Merge branch 'side' (early part) into tangle
608+
| | |
609+
| * | commit COMMIT_OBJECT_NAME
610+
| |\ \ Merge: MERGE_PARENTS
611+
| | | | Author: A U Thor <[email protected]>
612+
| | | |
613+
| | | | Merge branch 'master' (early part) into tangle
614+
| | | |
615+
| * | | commit COMMIT_OBJECT_NAME
616+
| | | | Author: A U Thor <[email protected]>
617+
| | | |
618+
| | | | tangle-a
619+
| | | | ---
620+
| | | | tangle-a | 1 +
621+
| | | | 1 file changed, 1 insertion(+)
622+
| | | |
623+
| | | | diff --git a/tangle-a b/tangle-a
624+
| | | | new file mode 100644
625+
| | | | index 0000000..7898192
626+
| | | | --- /dev/null
627+
| | | | +++ b/tangle-a
628+
| | | | @@ -0,0 +1 @@
629+
| | | | +a
630+
| | | |
631+
* | | | commit COMMIT_OBJECT_NAME
632+
|\ \ \ \ Merge: MERGE_PARENTS
633+
| | | | | Author: A U Thor <[email protected]>
634+
| | | | |
635+
| | | | | Merge branch 'side'
636+
| | | | |
637+
| * | | | commit COMMIT_OBJECT_NAME
638+
| | |_|/ Author: A U Thor <[email protected]>
639+
| |/| |
640+
| | | | side-2
641+
| | | | ---
642+
| | | | 2 | 1 +
643+
| | | | 1 file changed, 1 insertion(+)
644+
| | | |
645+
| | | | diff --git a/2 b/2
646+
| | | | new file mode 100644
647+
| | | | index 0000000..0cfbf08
648+
| | | | --- /dev/null
649+
| | | | +++ b/2
650+
| | | | @@ -0,0 +1 @@
651+
| | | | +2
652+
| | | |
653+
| * | | commit COMMIT_OBJECT_NAME
654+
| | | | Author: A U Thor <[email protected]>
655+
| | | |
656+
| | | | side-1
657+
| | | | ---
658+
| | | | 1 | 1 +
659+
| | | | 1 file changed, 1 insertion(+)
660+
| | | |
661+
| | | | diff --git a/1 b/1
662+
| | | | new file mode 100644
663+
| | | | index 0000000..d00491f
664+
| | | | --- /dev/null
665+
| | | | +++ b/1
666+
| | | | @@ -0,0 +1 @@
667+
| | | | +1
668+
| | | |
669+
* | | | commit COMMIT_OBJECT_NAME
670+
| | | | Author: A U Thor <[email protected]>
671+
| | | |
672+
| | | | Second
673+
| | | | ---
674+
| | | | one | 1 +
675+
| | | | 1 file changed, 1 insertion(+)
676+
| | | |
677+
| | | | diff --git a/one b/one
678+
| | | | new file mode 100644
679+
| | | | index 0000000..9a33383
680+
| | | | --- /dev/null
681+
| | | | +++ b/one
682+
| | | | @@ -0,0 +1 @@
683+
| | | | +case
684+
| | | |
685+
* | | | commit COMMIT_OBJECT_NAME
686+
| |_|/ Author: A U Thor <[email protected]>
687+
|/| |
688+
| | | sixth
689+
| | | ---
690+
| | | a/two | 1 -
691+
| | | 1 file changed, 1 deletion(-)
692+
| | |
693+
| | | diff --git a/a/two b/a/two
694+
| | | deleted file mode 100644
695+
| | | index 9245af5..0000000
696+
| | | --- a/a/two
697+
| | | +++ /dev/null
698+
| | | @@ -1 +0,0 @@
699+
| | | -ni
700+
| | |
701+
* | | commit COMMIT_OBJECT_NAME
702+
| | | Author: A U Thor <[email protected]>
703+
| | |
704+
| | | fifth
705+
| | | ---
706+
| | | a/two | 1 +
707+
| | | 1 file changed, 1 insertion(+)
708+
| | |
709+
| | | diff --git a/a/two b/a/two
710+
| | | new file mode 100644
711+
| | | index 0000000..9245af5
712+
| | | --- /dev/null
713+
| | | +++ b/a/two
714+
| | | @@ -0,0 +1 @@
715+
| | | +ni
716+
| | |
717+
* | | commit COMMIT_OBJECT_NAME
718+
|/ / Author: A U Thor <[email protected]>
719+
| |
720+
| | fourth
721+
| | ---
722+
| | ein | 1 +
723+
| | 1 file changed, 1 insertion(+)
724+
| |
725+
| | diff --git a/ein b/ein
726+
| | new file mode 100644
727+
| | index 0000000..9d7e69f
728+
| | --- /dev/null
729+
| | +++ b/ein
730+
| | @@ -0,0 +1 @@
731+
| | +ichi
732+
| |
733+
* | commit COMMIT_OBJECT_NAME
734+
|/ Author: A U Thor <[email protected]>
735+
|
736+
| third
737+
| ---
738+
| ichi | 1 +
739+
| one | 1 -
740+
| 2 files changed, 1 insertion(+), 1 deletion(-)
741+
|
742+
| diff --git a/ichi b/ichi
743+
| new file mode 100644
744+
| index 0000000..9d7e69f
745+
| --- /dev/null
746+
| +++ b/ichi
747+
| @@ -0,0 +1 @@
748+
| +ichi
749+
| diff --git a/one b/one
750+
| deleted file mode 100644
751+
| index 9d7e69f..0000000
752+
| --- a/one
753+
| +++ /dev/null
754+
| @@ -1 +0,0 @@
755+
| -ichi
756+
|
757+
* commit COMMIT_OBJECT_NAME
758+
| Author: A U Thor <[email protected]>
759+
|
760+
| second
761+
| ---
762+
| one | 2 +-
763+
| 1 file changed, 1 insertion(+), 1 deletion(-)
764+
|
765+
| diff --git a/one b/one
766+
| index 5626abf..9d7e69f 100644
767+
| --- a/one
768+
| +++ b/one
769+
| @@ -1 +1 @@
770+
| -one
771+
| +ichi
772+
|
773+
* commit COMMIT_OBJECT_NAME
774+
Author: A U Thor <[email protected]>
775+
776+
initial
777+
---
778+
one | 1 +
779+
1 file changed, 1 insertion(+)
780+
781+
diff --git a/one b/one
782+
new file mode 100644
783+
index 0000000..5626abf
784+
--- /dev/null
785+
+++ b/one
786+
@@ -0,0 +1 @@
787+
+one
788+
EOF
789+
790+
sanitize_output () {
791+
sed -e 's/ *$//' \
792+
-e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
793+
-e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
794+
-e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
795+
-e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
796+
-e 's/, 0 deletions(-)//' \
797+
-e 's/, 0 insertions(+)//' \
798+
-e 's/ 1 files changed, / 1 file changed, /' \
799+
-e 's/, 1 deletions(-)/, 1 deletion(-)/' \
800+
-e 's/, 1 insertions(+)/, 1 insertion(+)/'
801+
}
802+
803+
test_expect_success 'log --graph with diff and stats' '
804+
git log --graph --pretty=short --stat -p >actual &&
805+
sanitize_output >actual.sanitized <actual &&
806+
test_cmp expect actual.sanitized
807+
'
808+
519809
test_done

0 commit comments

Comments
 (0)