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
() {
24 test_expect_success
"ls-tree '--format=<$format>' is like options '$opts $fmtopts'" '
25 git ls-tree $opts -r HEAD >expect &&
26 git ls-tree --format="$format" -r $fmtopts HEAD >actual &&
27 test_cmp expect actual
30 test_expect_success
"ls-tree '--format=<$format>' on optimized v.s. non-optimized path" '
31 git ls-tree --format="$format" -r $fmtopts HEAD >expect &&
32 git ls-tree --format="> $format" -r $fmtopts HEAD >actual.raw &&
33 sed "s/^> //" >actual <actual.raw &&
34 test_cmp expect actual
38 test_expect_success
"ls-tree --format='%(path) %(path) %(path)' HEAD top-file" '
39 git ls-tree --format="%(path) %(path) %(path)" HEAD top-file.t >actual &&
40 echo top-file.t top-file.t top-file.t >expect &&
41 test_cmp expect actual
45 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
49 "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)" \
62 "--object-only --abbrev" \
66 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
71 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \
76 "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \