summaryrefslogtreecommitdiff
path: root/contrib/diff-highlight
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-03-21 05:49:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-21 17:24:19 (GMT)
commit7ce2f4ca0e35a987fb29d11ae06438a93fd48873 (patch)
tree9df5250709b9b2b2f3487b9fc7264afd125d352b /contrib/diff-highlight
parente28ae5072f633d77c65817db7b3aeb07d531a8d9 (diff)
downloadgit-7ce2f4ca0e35a987fb29d11ae06438a93fd48873.zip
git-7ce2f4ca0e35a987fb29d11ae06438a93fd48873.tar.gz
git-7ce2f4ca0e35a987fb29d11ae06438a93fd48873.tar.bz2
diff-highlight: test interleaved parallel lines of history
The graph test in t9400 covers the case of two simultaneous branches, but all of the commits during this time are on the right-hand branch. So we test a graph structure like: | | | * commit ... | | but we never see the reverse, a commit on the left-hand branch: | | * | commit ... | | Since this is an easy thing to get wrong when touching the graph-matching code, let's cover it by adding one more commit with its timestamp interleaved with the other branch. Note that we need to pass --date-order to convince Git to show it this way (since --topo-order tries to keep lines of history separate). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/diff-highlight')
-rwxr-xr-xcontrib/diff-highlight/t/t9400-diff-highlight.sh22
1 files changed, 15 insertions, 7 deletions
diff --git a/contrib/diff-highlight/t/t9400-diff-highlight.sh b/contrib/diff-highlight/t/t9400-diff-highlight.sh
index 3f02d31..33bcdbc 100755
--- a/contrib/diff-highlight/t/t9400-diff-highlight.sh
+++ b/contrib/diff-highlight/t/t9400-diff-highlight.sh
@@ -52,15 +52,17 @@ test_strip_patch_header () {
# dh_test_setup_history generates a contrived graph such that we have at least
# 1 nesting (E) and 2 nestings (F).
#
-# A master
+# A---B master
# /
# D---E---F branch
#
# git log --all --graph
# * commit
-# | A
+# | B
# | * commit
# | | F
+# * | commit
+# | | A
# | * commit
# |/
# | E
@@ -78,14 +80,20 @@ dh_test_setup_history () {
test_tick &&
git commit -a -m "E" &&
+ git checkout master &&
+ echo file2 >file &&
+ test_tick &&
+ git commit -a -m "A" &&
+
+ git checkout branch &&
echo file3 >file &&
test_tick &&
git commit -a -m "F" &&
git checkout master &&
- echo file2 >file &&
+ echo file3 >file &&
test_tick &&
- git commit -a -m "A"
+ git commit -a -m "B"
}
left_trim () {
@@ -246,12 +254,12 @@ test_expect_failure 'diff-highlight treats combining code points as a unit' '
test_expect_success 'diff-highlight works with the --graph option' '
dh_test_setup_history &&
- # topo-order so that the order of the commits is the same as with --graph
+ # date-order so that the commits are interleaved for both
# trim graph elements so we can do a diff
# trim leading space because our trim_graph is not perfect
- git log --branches -p --topo-order |
+ git log --branches -p --date-order |
"$DIFF_HIGHLIGHT" | left_trim >graph.exp &&
- git log --branches -p --graph |
+ git log --branches -p --date-order --graph |
"$DIFF_HIGHLIGHT" | trim_graph | left_trim >graph.act &&
test_cmp graph.exp graph.act
'