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