3 test_description
='ls-tree --format'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'ls-tree --format usage' '
9 test_expect_code 129 git ls-tree --format=fmt -l HEAD &&
10 test_expect_code 129 git ls-tree --format=fmt --name-only HEAD &&
11 test_expect_code 129 git ls-tree --format=fmt --name-status HEAD
14 test_expect_success
'setup' '
16 test_commit dir/sub-file &&
20 test_ls_tree_format
() {
26 test_expect_success
"ls-tree '--format=<$format>' is like options '$opts $fmtopts'" '
27 git ls-tree $opts -r HEAD >expect &&
28 git ls-tree --format="$format" -r $fmtopts HEAD >actual &&
29 test_cmp expect actual
32 test_expect_success
"ls-tree '--format=<$format>' on optimized v.s. non-optimized path" '
33 git ls-tree --format="$format" -r $fmtopts HEAD >expect &&
34 git ls-tree --format="> $format" -r $fmtopts HEAD >actual.raw &&
35 sed "s/^> //" >actual <actual.raw &&
36 test_cmp expect actual
41 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
45 "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)" \
58 "--object-only --abbrev" \
62 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
67 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
72 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \