@matheusbsbs / matheus-bagliano / commits / 788743240e
Fork 0

t4016: test quoting funny pathnames in diff output

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 11, 2007 at 13:28 UTC 788743240e7076a285e226ca230385e041d66db5
1 file changed +66
t/t4016-diff-quote.sh new
+66
@@ -0,0 +1,66 @@
1 +#!/bin/sh
2 +#
3 +# Copyright (c) 2007 Junio C Hamano
4 +#
5 +
6 +test_description='Quoting paths in diff output.
7 +'
8 +
9 +. ./test-lib.sh
10 +
11 +P0='pathname'
12 +P1='pathname with HT'
13 +P2='pathname with SP'
14 +P3='pathname
15 +with LF'
16 +
17 +test_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 +
37 +cat >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%)
45 +EOF
46 +test_expect_success 'git diff --summary -M HEAD' '
47 + git diff --summary -M HEAD >actual &&
48 + diff -u expect actual
49 +'
50 +
51 +cat >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(-)
60 +EOF
61 +test_expect_success 'git diff --stat -M HEAD' '
62 + git diff --stat -M HEAD >actual &&
63 + diff -u expect actual
64 +'
65 +
66 +test_done