Add tests for git log --pretty, --format and --oneline.
More specifically; --pretty=format, tformat and new %foo shortcut. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Felipe Contreras committed
Feb 24, 2009 at 23:06 UTC
bb93afd5153948e58d6b09c86e7c106a65dbfb65
1 file changed
+40
t/t4202-log.sh
+40
@@ -37,6 +37,46 @@ test_expect_success setup '
37
38
'
39
40
+printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial" > expect
41
+test_expect_success 'pretty' '
42
+
43
+ git log --pretty="format:%s" > actual &&
44
+ test_cmp expect actual
45
+'
46
+
47
+printf "sixth\nfifth\nfourth\nthird\nsecond\ninitial\n" > expect
48
+test_expect_success 'pretty (tformat)' '
49
+
50
+ git log --pretty="tformat:%s" > actual &&
51
+ test_cmp expect actual
52
+'
53
+
54
+test_expect_success 'pretty (shortcut)' '
55
+
56
+ git log --pretty="%s" > actual &&
57
+ test_cmp expect actual
58
+'
59
+
60
+test_expect_success 'format' '
61
+
62
+ git log --format="%s" > actual &&
63
+ test_cmp expect actual
64
+'
65
+
66
+cat > expect << EOF
67
+804a787 sixth
68
+394ef78 fifth
69
+5d31159 fourth
70
+2fbe8c0 third
71
+f7dab8e second
72
+3a2fdcb initial
73
+EOF
74
+test_expect_success 'oneline' '
75
+
76
+ git log --oneline > actual &&
77
+ test_cmp expect actual
78
+'
79
+
80
test_expect_success 'diff-filter=A' '
81
82
actual=$(git log --pretty="format:%s" --diff-filter=A HEAD) &&