]> git.ipfire.org Git - thirdparty/git.git/commit
ls-files: align format atoms with ls-tree
authorZheNing Hu <adlternative@gmail.com>
Tue, 23 May 2023 09:00:18 +0000 (09:00 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 May 2023 11:12:57 +0000 (20:12 +0900)
commit4d28c4f75fc12e7795fb2c1db2caedb6d9648af8
treeca69b1cb46b4bf86b5c76b936e80c82902a7f3b5
parent5bc069e383539824fd3a0d897100d44bbe1f8a24
ls-files: align format atoms with ls-tree

"git ls-files --format" can be used to format the output of
multiple file entries in the index, while "git ls-tree --format"
can be used to format the contents of a tree object. However,
the current set of %(objecttype), "(objectsize)", and
"%(objectsize:padded)" atoms supported by "git ls-files --format"
is a subset of what is available in "git ls-tree --format".

Users sometimes need to establish a unified view between the index
and tree, which can help with comparison or conversion between the two.

Therefore, this patch adds the missing atoms to "git ls-files --format".
"%(objecttype)" can be used to retrieve the object type corresponding
to a file in the index, "(objectsize)" can be used to retrieve the
object size corresponding to a file in the index, and "%(objectsize:padded)"
is the same as "(objectsize)", except with padded format.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-ls-files.txt
builtin/ls-files.c
t/t3013-ls-files-format.sh