format-patch: introduce format.useAutoBase configuration
[gitweb.git] / t / t3034-merge-recursive-rename-options.sh
index 51c2f87202cc1ae5636a3398dd099ef70fda040c..b9c4028496f97bc9a620df89768e07c6a99bb07d 100755 (executable)
@@ -83,6 +83,14 @@ check_exact_renames () {
        rename_detected 3
 }
 
+check_no_renames () {
+       check_common &&
+       rename_undetected 0 &&
+       rename_undetected 1 &&
+       rename_undetected 2 &&
+       rename_undetected 3
+}
+
 test_expect_success 'setup repo' '
        cat <<-\EOF >3-old &&
        33a
@@ -195,6 +203,12 @@ test_expect_success 'rename threshold is truncated' '
        check_exact_renames
 '
 
+test_expect_success 'disabled rename detection' '
+       git read-tree --reset -u HEAD &&
+       git merge-recursive --no-renames $tail &&
+       check_no_renames
+'
+
 test_expect_success 'last wins in --find-renames=<m> --find-renames=<n>' '
        git read-tree --reset -u HEAD &&
        test_must_fail git merge-recursive \
@@ -209,6 +223,18 @@ test_expect_success '--find-renames resets threshold' '
        $check_50
 '
 
+test_expect_success 'last wins in --no-renames --find-renames' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive --no-renames --find-renames $tail &&
+       $check_50
+'
+
+test_expect_success 'last wins in --find-renames --no-renames' '
+       git read-tree --reset -u HEAD &&
+       git merge-recursive --find-renames --no-renames $tail &&
+       check_no_renames
+'
+
 test_expect_success 'assumption for further tests: trivial merge succeeds' '
        git read-tree --reset -u HEAD &&
        git merge-recursive HEAD -- HEAD HEAD &&
@@ -218,6 +244,8 @@ test_expect_success 'assumption for further tests: trivial merge succeeds' '
        git merge-recursive --find-renames=$th2 HEAD -- HEAD HEAD &&
        git diff --quiet --cached &&
        git merge-recursive --find-renames=100% HEAD -- HEAD HEAD &&
+       git diff --quiet --cached &&
+       git merge-recursive --no-renames HEAD -- HEAD HEAD &&
        git diff --quiet --cached
 '
 
@@ -235,4 +263,50 @@ test_expect_success '--find-renames rejects non-numbers' '
        git diff --quiet --cached
 '
 
+test_expect_success 'rename-threshold=<n> is a synonym for find-renames=<n>' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive --rename-threshold=$th0 $tail &&
+       check_threshold_0
+'
+
+test_expect_success 'last wins in --no-renames --rename-threshold=<n>' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive --no-renames --rename-threshold=$th0 $tail &&
+       check_threshold_0
+'
+
+test_expect_success 'last wins in --rename-threshold=<n> --no-renames' '
+       git read-tree --reset -u HEAD &&
+       git merge-recursive --rename-threshold=$th0 --no-renames $tail &&
+       check_no_renames
+'
+
+test_expect_success '--rename-threshold=<n> rejects negative argument' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive --rename-threshold=-25 \
+               HEAD -- HEAD HEAD &&
+       git diff --quiet --cached
+'
+
+test_expect_success '--rename-threshold=<n> rejects non-numbers' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive --rename-threshold=0xf \
+               HEAD -- HEAD HEAD &&
+       git diff --quiet --cached
+'
+
+test_expect_success 'last wins in --rename-threshold=<m> --find-renames=<n>' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive \
+               --rename-threshold=$th0 --find-renames=$th2 $tail &&
+       check_threshold_2
+'
+
+test_expect_success 'last wins in --find-renames=<m> --rename-threshold=<n>' '
+       git read-tree --reset -u HEAD &&
+       test_must_fail git merge-recursive \
+               --find-renames=$th2 --rename-threshold=$th0 $tail &&
+       check_threshold_0
+'
+
 test_done