File tree Expand file tree Collapse file tree 3 files changed +72
-3
lines changed Expand file tree Collapse file tree 3 files changed +72
-3
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ Issues of note:
79
79
- "perl" and POSIX-compliant shells are needed to use most of
80
80
the barebone Porcelainish scripts.
81
81
82
- - "cpio" is used by git-merge for saving and restoring the index,
83
- and by git-clone when doing a local (possibly hardlinked) clone.
82
+ - "cpio" is used by git-clone when doing a local (possibly
83
+ hardlinked) clone.
84
84
85
85
- Some platform specific issues are dealt with Makefile rules,
86
86
but depending on your specific installation, you may not
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ static int parse_color(const char *name, int len)
17
17
return i - 1 ;
18
18
}
19
19
i = strtol (name , & end , 10 );
20
- if (* name && ! * end && i >= -1 && i <= 255 )
20
+ if (end - name == len && i >= -1 && i <= 255 )
21
21
return i ;
22
22
return -2 ;
23
23
}
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ #
3
+ # Copyright (c) 2008 Timo Hirvonen
4
+ #
5
+
6
+ test_description=' Test diff/status color escape codes'
7
+ . ./test-lib.sh
8
+
9
+ color ()
10
+ {
11
+ git config diff.color.new " $1 " &&
12
+ test " ` git config --get-color diff.color.new` " = " $2 "
13
+ }
14
+
15
+ invalid_color ()
16
+ {
17
+ git config diff.color.new " $1 " &&
18
+ test -z " ` git config --get-color diff.color.new 2> /dev/null` "
19
+ }
20
+
21
+ test_expect_success ' reset' '
22
+ color "reset" "[m"
23
+ '
24
+
25
+ test_expect_success ' attribute before color name' '
26
+ color "bold red" "[1;31m"
27
+ '
28
+
29
+ test_expect_success ' color name before attribute' '
30
+ color "red bold" "[1;31m"
31
+ '
32
+
33
+ test_expect_success ' attr fg bg' '
34
+ color "ul blue red" "[4;34;41m"
35
+ '
36
+
37
+ test_expect_success ' fg attr bg' '
38
+ color "blue ul red" "[4;34;41m"
39
+ '
40
+
41
+ test_expect_success ' fg bg attr' '
42
+ color "blue red ul" "[4;34;41m"
43
+ '
44
+
45
+ test_expect_success ' 256 colors' '
46
+ color "254 bold 255" "[1;38;5;254;48;5;255m"
47
+ '
48
+
49
+ test_expect_success ' color too small' '
50
+ invalid_color "-2"
51
+ '
52
+
53
+ test_expect_success ' color too big' '
54
+ invalid_color "256"
55
+ '
56
+
57
+ test_expect_success ' extra character after color number' '
58
+ invalid_color "3X"
59
+ '
60
+
61
+ test_expect_success ' extra character after color name' '
62
+ invalid_color "redX"
63
+ '
64
+
65
+ test_expect_success ' extra character after attribute' '
66
+ invalid_color "dimX"
67
+ '
68
+
69
+ test_done
You can’t perform that action at this time.
0 commit comments