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
39 test_expect_success
"ls-tree --format='%(path) %(path) %(path)' HEAD top-file" '
40 git ls-tree --format="%(path) %(path) %(path)" HEAD top-file.t >actual &&
41 echo top-file.t top-file.t top-file.t >expect &&
42 test_cmp expect actual
46 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
50 "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)" \
63 "--object-only --abbrev" \
67 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
72 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
77 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \