Thread (1 message) 1 message, 1 author, 2016-08-17

Re: [PATCH v2 2/3] diff-highlight: add failing test for handling --graph output.

From: Junio C Hamano <hidden>
Date: 2016-08-17 19:19:14

Brian Henderson [off-list ref] writes:
quoted hunk
Signed-off-by: Brian Henderson <redacted>
---
 contrib/diff-highlight/t/t9400-diff-highlight.sh | 13 +++++++
 contrib/diff-highlight/t/test-diff-highlight.sh  | 43 ++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
diff --git a/contrib/diff-highlight/t/t9400-diff-highlight.sh b/contrib/diff-highlight/t/t9400-diff-highlight.sh
index 8eff178..39707c6 100755
--- a/contrib/diff-highlight/t/t9400-diff-highlight.sh
+++ b/contrib/diff-highlight/t/t9400-diff-highlight.sh
@@ -59,4 +59,17 @@ test_expect_success 'diff-highlight does not highlight mismatched hunk size' '
 
 # TODO add multi-byte test
 
+test_expect_success 'diff-highlight highlights the beginning of a line' '
+	dh_graph_test \
+		"aaa\nbbb\nccc\n" \
+		"aaa\n0bb\nccc\n" \
+		"aaa\nb0b\nccc\n" \
+"
+ aaa
+-${CW}b${CR}bb
++${CW}0${CR}bb
+ ccc
+"
+'
Is this expected to pass after applying 1/3 and 2/3?  The title says
"add faililng test", so I am assuming this is expected to fail, in
which case the test should start out as "test_expect_failure".  A
later patch that makes it pass should turn "test_expect_failure"
into "test_expect_success".
quoted hunk
 test_done
diff --git a/contrib/diff-highlight/t/test-diff-highlight.sh b/contrib/diff-highlight/t/test-diff-highlight.sh
index 38323e8..67f742c 100644
--- a/contrib/diff-highlight/t/test-diff-highlight.sh
+++ b/contrib/diff-highlight/t/test-diff-highlight.sh
@@ -64,6 +64,49 @@ dh_commit_test() {
 	test_cmp commit.exp commit.act
 }
 
+dh_graph_test() {
+	a="$1" b="$2" c="$3"
+
+	{
+		printf "$a" >file
+ ...
+		git merge master
+		git checkout master
+		git merge branch --no-ff
+	} >/dev/null 2>&1
+
+	git log -p --graph --no-merges >graph.raw
Hmph, when does it make sense to have "--no-merges" together with
"--graph".  Doesn't it result in a disconnected mess?  Is that an
interesting and most often used case?
+
+	# git log --graph orders the commits different than git log so we hack it by
+	# using sed to remove the graph part.
Would it help if you knew "log --topo-order" to remove the "hack"?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help