t / t7525-status-rename.shon commit Merge branch 'jt/partial-clone-proto-v2' (54db5c0)
   1#!/bin/sh
   2
   3test_description='git status rename detection options'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8        echo 1 >original &&
   9        git add . &&
  10        git commit -m"Adding original file." &&
  11        mv original renamed &&
  12        echo 2 >> renamed &&
  13        git add . &&
  14        cat >.gitignore <<-\EOF
  15        .gitignore
  16        expect*
  17        actual*
  18        EOF
  19'
  20
  21test_expect_success 'status no-options' '
  22        git status >actual &&
  23        test_i18ngrep "renamed:" actual
  24'
  25
  26test_expect_success 'status --no-renames' '
  27        git status --no-renames >actual &&
  28        test_i18ngrep "deleted:" actual &&
  29        test_i18ngrep "new file:" actual
  30'
  31
  32test_expect_success 'status.renames inherits from diff.renames false' '
  33        git -c diff.renames=false status >actual &&
  34        test_i18ngrep "deleted:" actual &&
  35        test_i18ngrep "new file:" actual
  36'
  37
  38test_expect_success 'status.renames inherits from diff.renames true' '
  39        git -c diff.renames=true status >actual &&
  40        test_i18ngrep "renamed:" actual
  41'
  42
  43test_expect_success 'status.renames overrides diff.renames false' '
  44        git -c diff.renames=true -c status.renames=false status >actual &&
  45        test_i18ngrep "deleted:" actual &&
  46        test_i18ngrep "new file:" actual
  47'
  48
  49test_expect_success 'status.renames overrides from diff.renames true' '
  50        git -c diff.renames=false -c status.renames=true status >actual &&
  51        test_i18ngrep "renamed:" actual
  52'
  53
  54test_expect_success 'status status.renames=false' '
  55        git -c status.renames=false status >actual &&
  56        test_i18ngrep "deleted:" actual &&
  57        test_i18ngrep "new file:" actual
  58'
  59
  60test_expect_success 'status status.renames=true' '
  61        git -c status.renames=true status >actual &&
  62        test_i18ngrep "renamed:" actual
  63'
  64
  65test_expect_success 'commit honors status.renames=false' '
  66        git -c status.renames=false commit --dry-run >actual &&
  67        test_i18ngrep "deleted:" actual &&
  68        test_i18ngrep "new file:" actual
  69'
  70
  71test_expect_success 'commit honors status.renames=true' '
  72        git -c status.renames=true commit --dry-run >actual &&
  73        test_i18ngrep "renamed:" actual
  74'
  75
  76test_expect_success 'status config overridden' '
  77        git -c status.renames=true status --no-renames >actual &&
  78        test_i18ngrep "deleted:" actual &&
  79        test_i18ngrep "new file:" actual
  80'
  81
  82test_expect_success 'status score=100%' '
  83        git status -M=100% >actual &&
  84        test_i18ngrep "deleted:" actual &&
  85        test_i18ngrep "new file:" actual &&
  86
  87        git status --find-rename=100% >actual &&
  88        test_i18ngrep "deleted:" actual &&
  89        test_i18ngrep "new file:" actual
  90'
  91
  92test_expect_success 'status score=01%' '
  93        git status -M=01% >actual &&
  94        test_i18ngrep "renamed:" actual &&
  95
  96        git status --find-rename=01% >actual &&
  97        test_i18ngrep "renamed:" actual
  98'
  99
 100test_expect_success 'copies not overridden by find-rename' '
 101        cp renamed copy &&
 102        git add copy &&
 103
 104        git -c status.renames=copies status -M=01% >actual &&
 105        test_i18ngrep "copied:" actual &&
 106        test_i18ngrep "renamed:" actual &&
 107
 108        git -c status.renames=copies status --find-rename=01% >actual &&
 109        test_i18ngrep "copied:" actual &&
 110        test_i18ngrep "renamed:" actual
 111'
 112
 113test_done