[PATCH 2/3] t1900,t1901: make repo tests hash-agnostic and wc-portable
From: Eslam reda ragheb <eslam.reda.div@gmail.com>
Signed-off-by: Eslam reda ragheb <eslam.reda.div@gmail.com>
---
t/t1900-repo.sh | 4 ++--
t/t1901-repo-structure.sh | 26 +++++++++++++-------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/t/t1900-repo.sh b/t/t1900-repo.sh
index 4bfd48b85c..dcacf84cc3 100755
--- a/t/t1900-repo.sh
+++ b/t/t1900-repo.sh
@@ -131,8 +131,8 @@ test_expect_success 'category key returns all matching keys' '
'
test_expect_success 'mixed key/category requests preserve request order' '
- cat >expect <<-\EOF &&
- object.format=sha1
+ cat >expect <<-EOF &&
+ object.format=$(test_oid algo)
layout.bare=false
layout.shallow=false
EOF
diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh
index 2d493fbbc4..d9e2842307 100755
--- a/t/t1901-repo-structure.sh
+++ b/t/t1901-repo-structure.sh
@@ -150,10 +150,10 @@ tree_max_entry_count() {
--filter=object:type=tree --filter-provided-objects | cut -d" " -f1)
do
entries=$(git cat-file -p "$oid" | wc -l) || return 1
- test "$entries" -gt "$max" && max=$entries
+ test $entries -gt $max && max=$entries
done
- echo "$max"
+ echo $max
}
blob_max_path_length() {
@@ -228,20 +228,20 @@ test_expect_success SHA1 'keyvalue and nul format' '
cat >expect <<-EOF &&
references.count=$(reference_count_total)
- references.branches.count=1
- references.tags.count=1
- references.remotes.count=0
+ references.branches.count=$(git for-each-ref --format="%(refname)" refs/heads | sed -n "\$=")
+ references.tags.count=$(git for-each-ref --format="%(refname)" refs/tags | sed -n "\$=")
+ references.remotes.count=$(git for-each-ref --format="%(refname)" refs/remotes | sed -n "\$=")
references.others.count=0
objects.count=$(object_count_total)
- objects.commits.count=42
- objects.trees.count=42
- objects.blobs.count=42
- objects.tags.count=1
+ objects.commits.count=$(object_type_count commit)
+ objects.trees.count=$(object_type_count tree)
+ objects.blobs.count=$(object_type_count blob)
+ objects.tags.count=$(object_type_count tag)
objects.inflated_size=$(object_total_inflated_size)
- objects.commits.inflated_size=9225
- objects.trees.inflated_size=28554
- objects.blobs.inflated_size=453
- objects.tags.inflated_size=132
+ objects.commits.inflated_size=$(object_type_total_inflated_size commit)
+ objects.trees.inflated_size=$(object_type_total_inflated_size tree)
+ objects.blobs.inflated_size=$(object_type_total_inflated_size blob)
+ objects.tags.inflated_size=$(object_type_total_inflated_size tag)
objects.max_inflated_size=$(object_max_inflated_size)
objects.commits.max_inflated_size=$(object_type_max_inflated_size commit)
objects.trees.max_inflated_size=$(object_type_max_inflated_size tree)
--
gitgitgadget