diff options
author | ZheNing Hu <adlternative@gmail.com> | 2023-05-23 09:00:18 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-05-23 20:12:57 +0900 |
commit | 4d28c4f75fc12e7795fb2c1db2caedb6d9648af8 (patch) | |
tree | ca69b1cb46b4bf86b5c76b936e80c82902a7f3b5 /Documentation/git-ls-files.txt | |
parent | 5bc069e383539824fd3a0d897100d44bbe1f8a24 (diff) | |
download | git-4d28c4f75fc12e7795fb2c1db2caedb6d9648af8.tar.gz |
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>
Diffstat (limited to 'Documentation/git-ls-files.txt')
-rw-r--r-- | Documentation/git-ls-files.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index 1abdd3c21c..1bc0328bb7 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -270,8 +270,14 @@ interpolated. The following "fieldname" are understood: objectmode:: The mode of the file which is recorded in the index. +objecttype:: + The object type of the file which is recorded in the index. objectname:: The name of the file which is recorded in the index. +objectsize[:padded]:: + The object size of the file which is recorded in the index + ("-" if the object is a `commit` or `tree`). + It also supports a padded format of size with "%(objectsize:padded)". stage:: The stage of the file which is recorded in the index. eolinfo:index:: |