On Sat, Nov 09, 2024 at 02:57:37PM +0530, Abhijeet Sonar wrote:
That makes sense, applied.
Abhijeet Sonar (2):
show-index: fix uninitialized hash function
t5300: add test for 'show-index --object-format'
builtin/show-index.c | 9 +++++++++
t/t5300-pack-object.sh | 18 ++++++++++++++++++
2 files changed, 27 insertions(+)
Range-diff against v5:
1: 05ee1e2ea5 = 1: 05ee1e2ea5 show-index: fix uninitialized hash function
2: c8a28aae55 ! 2: 778f3ca18e t5300: add test for 'show-index --object-format'
@@ t/t5300-pack-object.sh: test_expect_success SHA1 'show-index works OK outside a
+for hash in sha1 sha256
+do
-+ test_expect_success 'setup: show-index works OK outside a repository with hash algo passed in via --object-format' '
-+ git init explicit-hash-$hash --object-format=$hash &&
-+ test_commit -C explicit-hash-$hash one &&
-+
-+ cat >in <<-EOF &&
-+ $(git -C explicit-hash-$hash rev-parse one)
-+ EOF
-+
-+ git -C explicit-hash-$hash pack-objects explicit-hash-$hash <in
-+ '
-+
+ test_expect_success 'show-index works OK outside a repository with hash algo passed in via --object-format' '
++ test_when_finished "rm -rf explicit-hash-$hash" &&
++ git init --object-format=$hash explicit-hash-$hash &&
++ test_commit -C explicit-hash-$hash one &&
++ git -C explicit-hash-$hash rev-parse one >in &&
++ git -C explicit-hash-$hash pack-objects explicit-hash-$hash <in &&
+ idx=$(echo explicit-hash-$hash/explicit-hash-$hash*.idx) &&
+ nongit git show-index --object-format=$hash <"$idx" >actual &&
-+ test_line_count = 1 actual &&
-+
-+ rm -rf explicit-hash-$hash
++ test_line_count = 1 actual
+ '
+done
+
Thanks, this version looks good to me.
Patrick