]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3206-range-diff.sh
Merge branch 'js/range-diff-wo-dotdot'
[thirdparty/git.git] / t / t3206-range-diff.sh
index 2b518378d4a0a8bb7d4e37222f89c0a42fad276c..b782d26820c6d1e62c9ad0b3d55176bc567b4cad 100755 (executable)
@@ -2,6 +2,9 @@
 
 test_description='range-diff tests'
 
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
 . ./test-lib.sh
 
 # Note that because of the range-diff's heuristics, test_commit does more
@@ -127,7 +130,7 @@ test_expect_success 'setup' '
 '
 
 test_expect_success 'simple A..B A..C (unmodified)' '
-       git range-diff --no-color master..topic master..unmodified \
+       git range-diff --no-color main..topic main..unmodified \
                >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -145,7 +148,7 @@ test_expect_success 'simple B...C (unmodified)' '
 '
 
 test_expect_success 'simple A B C (unmodified)' '
-       git range-diff --no-color master topic unmodified >actual &&
+       git range-diff --no-color main topic unmodified >actual &&
        # same "expect" as above
        test_cmp expect actual
 '
@@ -164,7 +167,7 @@ test_expect_success 'A^{/..} is not mistaken for a range' '
 '
 
 test_expect_success 'trivial reordering' '
-       git range-diff --no-color master topic reordered >actual &&
+       git range-diff --no-color main topic reordered >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid r1) s/5/A/
        3:  $(test_oid t3) = 2:  $(test_oid r2) s/11/B/
@@ -175,7 +178,7 @@ test_expect_success 'trivial reordering' '
 '
 
 test_expect_success 'removed a commit' '
-       git range-diff --no-color master topic removed >actual &&
+       git range-diff --no-color main topic removed >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid d1) s/5/A/
        2:  $(test_oid t2) < -:  $(test_oid __) s/4/A/
@@ -186,7 +189,7 @@ test_expect_success 'removed a commit' '
 '
 
 test_expect_success 'added a commit' '
-       git range-diff --no-color master topic added >actual &&
+       git range-diff --no-color main topic added >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid a1) s/5/A/
        2:  $(test_oid t2) = 2:  $(test_oid a2) s/4/A/
@@ -198,7 +201,7 @@ test_expect_success 'added a commit' '
 '
 
 test_expect_success 'new base, A B C' '
-       git range-diff --no-color master topic rebased >actual &&
+       git range-diff --no-color main topic rebased >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid b1) s/5/A/
        2:  $(test_oid t2) = 2:  $(test_oid b2) s/4/A/
@@ -209,7 +212,7 @@ test_expect_success 'new base, A B C' '
 '
 
 test_expect_success 'new base, B...C' '
-       # this syntax includes the commits from master!
+       # this syntax includes the commits from main!
        git range-diff --no-color topic...rebased >actual &&
        cat >expect <<-EOF &&
        -:  $(test_oid __) > 1:  $(test_oid b5) unrelated
@@ -433,7 +436,7 @@ test_expect_success 'file added and later removed' '
 
 test_expect_success 'no commits on one side' '
        git commit --amend -m "new message" &&
-       git range-diff master HEAD@{1} HEAD
+       git range-diff main HEAD@{1} HEAD
 '
 
 test_expect_success 'changed message' '
@@ -495,11 +498,11 @@ test_expect_success 'dual-coloring' '
        test_cmp expect actual
 '
 
-for prev in topic master..topic
+for prev in topic main..topic
 do
        test_expect_success "format-patch --range-diff=$prev" '
                git format-patch --cover-letter --range-diff=$prev \
-                       master..unmodified >actual &&
+                       main..unmodified >actual &&
                test_when_finished "rm 000?-*" &&
                test_line_count = 5 actual &&
                test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -524,19 +527,19 @@ test_expect_success 'range-diff overrides diff.noprefix internally' '
 
 test_expect_success 'basic with modified format.pretty with suffix' '
        git -c format.pretty="format:commit %H%d%n" range-diff \
-               master..topic master..unmodified
+               main..topic main..unmodified
 '
 
 test_expect_success 'basic with modified format.pretty without "commit "' '
        git -c format.pretty="format:%H%n" range-diff \
-               master..topic master..unmodified
+               main..topic main..unmodified
 '
 
 test_expect_success 'range-diff compares notes by default' '
        git notes add -m "topic note" topic &&
        git notes add -m "unmodified note" unmodified &&
        test_when_finished git notes remove topic unmodified &&
-       git range-diff --no-color master..topic master..unmodified \
+       git range-diff --no-color main..topic main..unmodified \
                >actual &&
        sed s/Z/\ /g >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -560,7 +563,7 @@ test_expect_success 'range-diff with --no-notes' '
        git notes add -m "topic note" topic &&
        git notes add -m "unmodified note" unmodified &&
        test_when_finished git notes remove topic unmodified &&
-       git range-diff --no-color --no-notes master..topic master..unmodified \
+       git range-diff --no-color --no-notes main..topic main..unmodified \
                >actual &&
        cat >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -578,7 +581,7 @@ test_expect_success 'range-diff with multiple --notes' '
        git notes --ref=note2 add -m "topic note2" topic &&
        git notes --ref=note2 add -m "unmodified note2" unmodified &&
        test_when_finished git notes --ref=note2 remove topic unmodified &&
-       git range-diff --no-color --notes=note1 --notes=note2 master..topic master..unmodified \
+       git range-diff --no-color --notes=note1 --notes=note2 main..topic main..unmodified \
                >actual &&
        sed s/Z/\ /g >expect <<-EOF &&
        1:  $(test_oid t1) = 1:  $(test_oid u1) s/5/A/
@@ -608,7 +611,7 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
        git notes add -m "unmodified note" unmodified &&
        test_when_finished git notes remove topic unmodified &&
        git format-patch --cover-letter --range-diff=$prev \
-               master..unmodified >actual &&
+               main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
        test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -625,7 +628,7 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
        git notes add -m "unmodified note" unmodified &&
        test_when_finished git notes remove topic unmodified &&
        git format-patch --no-notes --cover-letter --range-diff=$prev \
-               master..unmodified >actual &&
+               main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
        test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -642,7 +645,7 @@ test_expect_success 'format-patch --range-diff with --notes' '
        git notes add -m "unmodified note" unmodified &&
        test_when_finished git notes remove topic unmodified &&
        git format-patch --notes --cover-letter --range-diff=$prev \
-               master..unmodified >actual &&
+               main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
        test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -671,7 +674,7 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
        test_when_finished git notes remove topic unmodified &&
        test_config format.notes true &&
        git format-patch --cover-letter --range-diff=$prev \
-               master..unmodified >actual &&
+               main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
        test_i18ngrep "^Range-diff:$" 0000-* &&
@@ -702,7 +705,7 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
        git notes --ref=note2 add -m "unmodified note2" unmodified &&
        test_when_finished git notes --ref=note2 remove topic unmodified &&
        git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
-               master..unmodified >actual &&
+               main..unmodified >actual &&
        test_when_finished "rm 000?-*" &&
        test_line_count = 5 actual &&
        test_i18ngrep "^Range-diff:$" 0000-* &&