Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-06-13 22:29:46 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-13 22:29:46 +0300
commit32fe7fff0c141784dcfcece405e8e1866c55a2a9 (patch)
tree9adc89e644b7f6ce3c4b41cf62e7fba8b36b3842 /t
parentca9c063c1820a78e29306c7d54b4f840ea5db62e (diff)
parent4d28c4f75fc12e7795fb2c1db2caedb6d9648af8 (diff)
Merge branch 'zh/ls-files-format-atoms'
Some atoms that can be used in "--format=<format>" for "git ls-tree" were not supported by "git ls-files", even though they were relevant in the context of the latter. * zh/ls-files-format-atoms: ls-files: align format atoms with ls-tree
Diffstat (limited to 't')
-rwxr-xr-xt/t3013-ls-files-format.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t3013-ls-files-format.sh b/t/t3013-ls-files-format.sh
index ef6fb53f7f..6e6ea0b6f3 100755
--- a/t/t3013-ls-files-format.sh
+++ b/t/t3013-ls-files-format.sh
@@ -38,6 +38,41 @@ test_expect_success 'git ls-files --format objectname v.s. -s' '
test_cmp expect actual
'
+test_expect_success 'git ls-files --format objecttype' '
+ git ls-files --format="%(objectname)" o1.txt o4.txt o6.txt >objectname &&
+ git cat-file --batch-check="%(objecttype)" >expect <objectname &&
+ git ls-files --format="%(objecttype)" o1.txt o4.txt o6.txt >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'git ls-files --format objectsize' '
+ cat>expect <<-\EOF &&
+26
+29
+27
+26
+-
+26
+ EOF
+ git ls-files --format="%(objectsize)" >actual &&
+
+ test_cmp expect actual
+'
+
+test_expect_success 'git ls-files --format objectsize:padded' '
+ cat>expect <<-\EOF &&
+ 26
+ 29
+ 27
+ 26
+ -
+ 26
+ EOF
+ git ls-files --format="%(objectsize:padded)" >actual &&
+
+ test_cmp expect actual
+'
+
test_expect_success 'git ls-files --format v.s. --eol' '
git ls-files --eol >tmp &&
sed -e "s/ / /g" -e "s/ */ /g" tmp >expect 2>err &&