Subject: [PATCH 0/2] ls-files: align format atoms with git ls-tree

From: "ZheNing Hu via GitGitGadget" <[email-masked]>
Date: Sat, 13 May 2023 09:11:37 +0000

Users sometimes want all format atoms of git ls-files --format to be
compatible with the format atoms of git ls-tree --format [1]. However, git
ls-files --format lacks the %(objecttype) and %(objectsize),
%(objectsize:padded) atoms compared to git ls-tree --format, causing
incompatibility. Therefore, these atoms are added to the --format of git
ls-files to resolve the issue of incompatibility.

%(objecttype): get the object type of the file which is recorded in the
index. %(objectsize): get the object size of the file which is recorded in
the index, ("-" if the object is a commit or tree). %(objectsize:padded):
same as %(objectsize), but with a padded format.

v1: add %(objecttype) and %(objectsize) atos to git ls-files --format.

[1]:
https://lore.kernel.org/git/[email-masked]/T/#u

ZheNing Hu (2):
  ls-files: add %(objecttype) atom to format option
  ls-files: add %(objectsize) atom to format option

 Documentation/git-ls-files.txt |  6 ++++++
 builtin/ls-files.c             | 27 ++++++++++++++++++++++++++
 t/t3013-ls-files-format.sh     | 35 ++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+)

base-commit: 5bc069e383539824fd3a0d897100d44bbe1f8a24
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1533%2Fadlternative%2Fzh%2Fls-files-formats-expand-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1533/adlternative/zh/ls-files-formats-expand-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1533
-- 
gitgitgadget