git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GSoC Patch 1/5] lib-log-graph.sh: consolidate test_cmp_graph logic
@ 2020-02-16 13:47 Abhishek Kumar
  2020-02-16 13:47 ` [GSoC Patch 2/5] t3430: use lib-log-graph functions Abhishek Kumar
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Abhishek Kumar @ 2020-02-16 13:47 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin

Logic for comparing log graphs is duplicated across test scripts.

This patchset consolidates such logic into lib-log-graph.

Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com>
---
1. I don't think this patchset requires a cover letter or extended
commit descriptions - Fairly simple, straightforward changes.
2. This patchset closes issue #471 from gitgitgadget.

 t/lib-log-graph.sh | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 t/lib-log-graph.sh

diff --git a/t/lib-log-graph.sh b/t/lib-log-graph.sh
new file mode 100644
index 0000000000..999f2600de
--- /dev/null
+++ b/t/lib-log-graph.sh
@@ -0,0 +1,39 @@
+# Helpers shared by the test scripts for comparing log graphs.
+
+sanitize_output() {
+	sed -e 's/ *$//' \
+	    -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
+	    -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
+	    -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \
+	    -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \
+	    -e 's/, 0 deletions(-)//' \
+	    -e 's/, 0 insertions(+)//' \
+	    -e 's/ 1 files changed, / 1 file changed, /' \
+	    -e 's/, 1 deletions(-)/, 1 deletion(-)/' \
+	    -e 's/, 1 insertions(+)/, 1 insertion(+)/' \
+	    -e 's/index [0-9a-f]*\.\.[0-9a-f]*/index BEFORE..AFTER/'
+}
+
+# Assume expected graph is in file `expect`
+test_cmp_graph_file() {
+	git log --graph "$@" >output &&
+	sanitize_output >output.trimmed <output &&
+	test_i18ncmp expect output.trimmed
+}
+
+test_cmp_graph() {
+	cat >expect &&
+	test_cmp_graph_file "$@"
+}
+
+# Assume expected graph is in file `expect.colors`
+test_cmp_colored_graph_file() {
+	git log --graph --color=always "$@" >output.colors.raw &&
+	test_decode_color <output.colors.raw | sed "s/ *\$//" >output.colors &&
+	test_cmp expect.colors output.colors
+}
+
+test_cmp_colored_graph() {
+	cat >expect.colors &&
+	test_cmp_colored_graph_file "$@"
+}
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2020-02-24 21:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-16 13:47 [GSoC Patch 1/5] lib-log-graph.sh: consolidate test_cmp_graph logic Abhishek Kumar
2020-02-16 13:47 ` [GSoC Patch 2/5] t3430: use lib-log-graph functions Abhishek Kumar
2020-02-19 17:23   ` Junio C Hamano
2020-02-16 13:47 ` [GSoC Patch 3/5] t4215: " Abhishek Kumar
2020-02-19 17:26   ` Junio C Hamano
2020-02-16 13:47 ` [GSoC Patch 4/5] t4214: " Abhishek Kumar
2020-02-19 17:29   ` Junio C Hamano
2020-02-16 13:47 ` [GSoC Patch 5/5] t4202: " Abhishek Kumar
2020-02-19 17:31   ` Junio C Hamano
2020-02-17  0:05 ` [GSoC Patch 1/5] lib-log-graph.sh: consolidate test_cmp_graph logic Junio C Hamano
2020-02-19 17:32   ` Junio C Hamano
2020-02-20  9:15 ` [GSoC PATCH v2 0/2] Consolidate " Abhishek Kumar
2020-02-20  9:15   ` [GSoC PATCH v2 1/2] lib-log-graph: consolidate " Abhishek Kumar
2020-02-20 17:49     ` Junio C Hamano
2020-02-20  9:15   ` [PATCH v2 2/2] lib-log-graph: consolidate colored graph cmp logic Abhishek Kumar
2020-02-24 13:38 ` [GSoC Patch v3 1/2] lib-log-graph: consolidate test_cmp_graph logic Abhishek Kumar
2020-02-24 13:38   ` [GSoC Patch v3 2/2] lib-log-graph: consolidate colored graph cmp logic Abhishek Kumar
2020-02-24 21:17   ` [GSoC Patch v3 1/2] lib-log-graph: consolidate test_cmp_graph logic Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).