3 test_description
='ls-tree --format'
5 TEST_PASSES_SANITIZE_LEAK
=true
7 .
"$TEST_DIRECTORY"/lib-t3100.sh
9 test_expect_success
'ls-tree --format usage' '
10 test_expect_code 129 git ls-tree --format=fmt -l HEAD &&
11 test_expect_code 129 git ls-tree --format=fmt --name-only HEAD &&
12 test_expect_code 129 git ls-tree --format=fmt --name-status HEAD
15 test_expect_success
'setup' '
16 setup_basic_ls_tree_data
19 test_ls_tree_format
() {
25 test_expect_success
"ls-tree '--format=<$format>' is like options '$opts $fmtopts'" '
26 git ls-tree $opts -r HEAD >expect &&
27 git ls-tree --format="$format" -r $fmtopts HEAD >actual &&
28 test_cmp expect actual
31 test_expect_success
"ls-tree '--format=<$format>' on optimized v.s. non-optimized path" '
32 git ls-tree --format="$format" -r $fmtopts HEAD >expect &&
33 git ls-tree --format="> $format" -r $fmtopts HEAD >actual.raw &&
34 sed "s/^> //" >actual <actual.raw &&
35 test_cmp expect actual
40 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
44 "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)" \
57 "--object-only --abbrev" \
61 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
66 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
71 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \