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