t / t4016-diff-quote.shon commit Merge branch 'as/graph' (c748152)
   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'
  16: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || {
  17        echo >&2 'Filesystem does not support tabs in names'
  18        test_done
  19}
  20
  21test_expect_success setup '
  22        echo P0.0 >"$P0.0" &&
  23        echo P0.1 >"$P0.1" &&
  24        echo P0.2 >"$P0.2" &&
  25        echo P0.3 >"$P0.3" &&
  26        echo P1.0 >"$P1.0" &&
  27        echo P1.2 >"$P1.2" &&
  28        echo P1.3 >"$P1.3" &&
  29        git add . &&
  30        git commit -m initial &&
  31        git mv "$P0.0" "R$P0.0" &&
  32        git mv "$P0.1" "R$P1.0" &&
  33        git mv "$P0.2" "R$P2.0" &&
  34        git mv "$P0.3" "R$P3.0" &&
  35        git mv "$P1.0" "R$P0.1" &&
  36        git mv "$P1.2" "R$P2.1" &&
  37        git mv "$P1.3" "R$P3.1" &&
  38        :
  39'
  40
  41cat >expect <<\EOF
  42 rename pathname.1 => "Rpathname\twith HT.0" (100%)
  43 rename pathname.3 => "Rpathname\nwith LF.0" (100%)
  44 rename "pathname\twith HT.3" => "Rpathname\nwith LF.1" (100%)
  45 rename pathname.2 => Rpathname with SP.0 (100%)
  46 rename "pathname\twith HT.2" => Rpathname with SP.1 (100%)
  47 rename pathname.0 => Rpathname.0 (100%)
  48 rename "pathname\twith HT.0" => Rpathname.1 (100%)
  49EOF
  50test_expect_success 'git diff --summary -M HEAD' '
  51        git diff --summary -M HEAD >actual &&
  52        git diff expect actual
  53'
  54
  55cat >expect <<\EOF
  56 pathname.1 => "Rpathname\twith HT.0"            |    0 
  57 pathname.3 => "Rpathname\nwith LF.0"            |    0 
  58 "pathname\twith HT.3" => "Rpathname\nwith LF.1" |    0 
  59 pathname.2 => Rpathname with SP.0               |    0 
  60 "pathname\twith HT.2" => Rpathname with SP.1    |    0 
  61 pathname.0 => Rpathname.0                       |    0 
  62 "pathname\twith HT.0" => Rpathname.1            |    0 
  63 7 files changed, 0 insertions(+), 0 deletions(-)
  64EOF
  65test_expect_success 'git diff --stat -M HEAD' '
  66        git diff --stat -M HEAD >actual &&
  67        git diff expect actual
  68'
  69
  70test_done