mbox series

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

Message ID pull.1533.git.1683969100.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series ls-files: align format atoms with git ls-tree | expand

Message

Philippe Blain via GitGitGadget May 13, 2023, 9:11 a.m. UTC
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/21183ea9-84e2-fd89-eb9b-419556680c07@gnieh.org/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