Skip to content

Commit cb85ee3

Browse files
t1900,t1901: make repo tests hash-agnostic and wc-portable
Signed-off-by: Eslam reda ragheb <eslam.reda.div@gmail.com>
1 parent 9f2b3a4 commit cb85ee3

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

t/t1900-repo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ test_expect_success 'category key returns all matching keys' '
131131
'
132132

133133
test_expect_success 'mixed key/category requests preserve request order' '
134-
cat >expect <<-\EOF &&
135-
object.format=sha1
134+
cat >expect <<-EOF &&
135+
object.format=$(test_oid algo)
136136
layout.bare=false
137137
layout.shallow=false
138138
EOF

t/t1901-repo-structure.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ tree_max_entry_count() {
150150
--filter=object:type=tree --filter-provided-objects | cut -d" " -f1)
151151
do
152152
entries=$(git cat-file -p "$oid" | wc -l) || return 1
153-
test "$entries" -gt "$max" && max=$entries
153+
test $entries -gt $max && max=$entries
154154
done
155155

156-
echo "$max"
156+
echo $max
157157
}
158158

159159
blob_max_path_length() {
@@ -228,20 +228,20 @@ test_expect_success SHA1 'keyvalue and nul format' '
228228
229229
cat >expect <<-EOF &&
230230
references.count=$(reference_count_total)
231-
references.branches.count=1
232-
references.tags.count=1
233-
references.remotes.count=0
231+
references.branches.count=$(git for-each-ref --format="%(refname)" refs/heads | sed -n "\$=")
232+
references.tags.count=$(git for-each-ref --format="%(refname)" refs/tags | sed -n "\$=")
233+
references.remotes.count=$(git for-each-ref --format="%(refname)" refs/remotes | sed -n "\$=")
234234
references.others.count=0
235235
objects.count=$(object_count_total)
236-
objects.commits.count=42
237-
objects.trees.count=42
238-
objects.blobs.count=42
239-
objects.tags.count=1
236+
objects.commits.count=$(object_type_count commit)
237+
objects.trees.count=$(object_type_count tree)
238+
objects.blobs.count=$(object_type_count blob)
239+
objects.tags.count=$(object_type_count tag)
240240
objects.inflated_size=$(object_total_inflated_size)
241-
objects.commits.inflated_size=9225
242-
objects.trees.inflated_size=28554
243-
objects.blobs.inflated_size=453
244-
objects.tags.inflated_size=132
241+
objects.commits.inflated_size=$(object_type_total_inflated_size commit)
242+
objects.trees.inflated_size=$(object_type_total_inflated_size tree)
243+
objects.blobs.inflated_size=$(object_type_total_inflated_size blob)
244+
objects.tags.inflated_size=$(object_type_total_inflated_size tag)
245245
objects.max_inflated_size=$(object_max_inflated_size)
246246
objects.commits.max_inflated_size=$(object_type_max_inflated_size commit)
247247
objects.trees.max_inflated_size=$(object_type_max_inflated_size tree)

0 commit comments

Comments
 (0)