t / t4016-diff-quote.shon commit config: work around bug with includeif:onbranch and early config (85fe0e8)
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Junio C Hamano
   4#
   5
   6test_description='Quoting paths in diff output.
   7'
   8
   9. ./test-lib.sh
  10
  11P0='pathname'
  12P1='pathname    with HT'
  13P2='pathname with SP'
  14P3='pathname
  15with LF'
  16test_have_prereq !MINGW &&
  17echo 2>/dev/null >"$P1" && test -f "$P1" && rm -f "$P1" || {
  18        skip_all='Your filesystem does not allow tabs in filenames'
  19        test_done
  20}
  21
  22test_expect_success setup '
  23        echo P0.0 >"$P0.0" &&
  24        echo P0.1 >"$P0.1" &&
  25        echo P0.2 >"$P0.2" &&
  26        echo P0.3 >"$P0.3" &&
  27        echo P1.0 >"$P1.0" &&
  28        echo P1.2 >"$P1.2" &&
  29        echo P1.3 >"$P1.3" &&
  30        git add . &&
  31        git commit -m initial &&
  32        git mv "$P0.0" "R$P0.0" &&
  33        git mv "$P0.1" "R$P1.0" &&
  34        git mv "$P0.2" "R$P2.0" &&
  35        git mv "$P0.3" "R$P3.0" &&
  36        git mv "$P1.0" "R$P0.1" &&
  37        git mv "$P1.2" "R$P2.1" &&
  38        git mv "$P1.3" "R$P3.1" &&
  39        :
  40'
  41
  42test_expect_success 'setup expected files' '
  43cat >expect <<\EOF
  44 rename pathname.1 => "Rpathname\twith HT.0" (100%)
  45 rename pathname.3 => "Rpathname\nwith LF.0" (100%)
  46 rename "pathname\twith HT.3" => "Rpathname\nwith LF.1" (100%)
  47 rename pathname.2 => Rpathname with SP.0 (100%)
  48 rename "pathname\twith HT.2" => Rpathname with SP.1 (100%)
  49 rename pathname.0 => Rpathname.0 (100%)
  50 rename "pathname\twith HT.0" => Rpathname.1 (100%)
  51EOF
  52'
  53
  54test_expect_success 'git diff --summary -M HEAD' '
  55        git diff --summary -M HEAD >actual &&
  56        test_cmp expect actual
  57'
  58
  59test_expect_success 'git diff --numstat -M HEAD' '
  60        cat >expect <<-\EOF &&
  61        0       0       pathname.1 => "Rpathname\twith HT.0"
  62        0       0       pathname.3 => "Rpathname\nwith LF.0"
  63        0       0       "pathname\twith HT.3" => "Rpathname\nwith LF.1"
  64        0       0       pathname.2 => Rpathname with SP.0
  65        0       0       "pathname\twith HT.2" => Rpathname with SP.1
  66        0       0       pathname.0 => Rpathname.0
  67        0       0       "pathname\twith HT.0" => Rpathname.1
  68        EOF
  69        git diff --numstat -M HEAD >actual &&
  70        test_cmp expect actual
  71'
  72
  73test_expect_success 'git diff --stat -M HEAD' '
  74        cat >expect <<-\EOF &&
  75         pathname.1 => "Rpathname\twith HT.0"            | 0
  76         pathname.3 => "Rpathname\nwith LF.0"            | 0
  77         "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0
  78         pathname.2 => Rpathname with SP.0               | 0
  79         "pathname\twith HT.2" => Rpathname with SP.1    | 0
  80         pathname.0 => Rpathname.0                       | 0
  81         "pathname\twith HT.0" => Rpathname.1            | 0
  82         7 files changed, 0 insertions(+), 0 deletions(-)
  83        EOF
  84        git diff --stat -M HEAD >actual &&
  85        test_i18ncmp expect actual
  86'
  87
  88test_done