| test_description='ls-tree --format' |
| TEST_PASSES_SANITIZE_LEAK=true |
| . "$TEST_DIRECTORY"/lib-t3100.sh |
| test_expect_success 'ls-tree --format usage' ' |
| test_expect_code 129 git ls-tree --format=fmt -l HEAD && |
| test_expect_code 129 git ls-tree --format=fmt --name-only HEAD && |
| test_expect_code 129 git ls-tree --format=fmt --name-status HEAD |
| test_expect_success 'setup' ' |
| test_expect_success "ls-tree '--format=<$format>' is like options '$opts $fmtopts'" ' |
| git ls-tree $opts -r HEAD >expect && |
| git ls-tree --format="$format" -r $fmtopts HEAD >actual && |
| test_expect_success "ls-tree '--format=<$format>' on optimized v.s. non-optimized path" ' |
| git ls-tree --format="$format" -r $fmtopts HEAD >expect && |
| git ls-tree --format="> $format" -r $fmtopts HEAD >actual.raw && |
| sed "s/^> //" >actual <actual.raw && |
| "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \ |
| "%(objectmode) %(objecttype) %(objectname) %(objectsize:padded)%x09%(path)" \ |
| "--object-only --abbrev" \ |
| "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \ |
| "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \ |
| "%(objectmode) %(objecttype) %(objectname)%x09%(path)" \ |