Skip to content

pr-1566/runsascoded/ls-tree-head-v1

From: Ryan Williams <ryan@runsascoded.com>

When no positional arguments are passed to `git ls-tree`, it currently
prints "usage" info to stderr and exits with code 129. A more intuitive
default would be to operate on the `HEAD` commit's tree (similarly to
`git show`, `git log`, and possibly others).

This patch updates `git ls-tree [options...]` to operate identically to
`git ls-tree [options...] HEAD`, updates the docs to reflect that
`<tree-ish>` is optional (and `[path...]` args can only be provided if a
`<tree-ish>` is explicitly provided first), and duplicates some existing
test cases to omit the `HEAD` argument to `ls-tree` (verifying that
`ls-tree` behaves identically whether `HEAD` is provided or not).

Signed-off-by: Ryan Williams <ryan@runsascoded.com>

Submitted-As: https://lore.kernel.org/git/pull.1566.git.1691412557518.gitgitgadget@gmail.com
Assets 2