Skip to contentSkip to conversation

Microproject: Modernize file check in t5300-pack-object.sh

Outreachy Superseded Ogundipe Sola Taiwo 3 participants 11 messages Oct 23 – Oct 29

lore
Share & tools
lore
#0 lore raw

Hi everyone,

My name is Sola Ogundipe. I'm an Outreachy applicant for the December 2026 round. I've cloned and setup the repo locally and also played around with adding a git command following the "My First Contribution Tutorial".

I'd like to work on modernizing the 5 occurences of file check in the t5300-pack-object.sh file. I've checked the public inbox and found no one working on fixing the same issue for this file.

Please let me know if I should proceed with the changes.

Best regards,
Sola

#1 lore raw

PATCH 1/1 t5300: modernize test path checks in t5300

This commit improves test t5300-pack-object by converting old-style path checks to use the test_path_is_file helper function.

---
 t/t5300-pack-object.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
t/t5300-pack-object.sh +5 -5
index aac139e6a0..e5ce478484 100755
@@ -283,11 +283,11 @@ test_expect_success 'survive missing objects/pack directory' '
 		GOP=.git/objects/pack &&
 		rm -fr $GOP &&
 		git index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.pack &&
+		test_path_is_file $GOP/pack-${packname_3}.pack &&
 		cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.idx &&
+		test_path_is_file $GOP/pack-${packname_3}.idx &&
 		cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&
-		test -f $GOP/pack-${packname_3}.keep
+		test_path_is_file $GOP/pack-${packname_3}.keep
 	)
 '
 
@@ -376,7 +376,7 @@ test_expect_success 'build pack index for an existing pack' '
 	rm -f test-4.keep &&
 	git index-pack --keep=why test-4.pack &&
 	cmp test-1-${packname_1}.idx test-4.idx &&
-	test -f test-4.keep &&
+	test_path_is_file test-4.keep &&
 
 	:
 '
@@ -616,7 +616,7 @@ test_expect_success 'setup: fake a SHA1 hash collision' '
 		cd corrupt &&
 		long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
 		long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
-		test -f	.git/objects/$long_b &&
+		test_path_is_file .git/objects/$long_b &&
 		cp -f	.git/objects/$long_a \
 			.git/objects/$long_b
 	)

--
2.56.0.116.g6de20f6092.dirty

#2 lore raw

Re: [PATCH] t5300: modernize test path checks in t5300

Quoted 2 lines · Ogundipe Sola Taiwo

This commit improves test t5300-pack-object by converting old-style

Could you rephrase this to avoid “This commit”? It's redundant in a commit message."
Please describe the change directly instead. Also, I believe, the term patch is more
appropriate and not "commit".

Quoted 4 lines

path checks to use the test_path_is_file helper function.

---

Apart from that, the changes looks good to me.

Quoted 3 lines

--
2.56.0.116.g6de20f6092.dirty

#3 lore raw
In reply to Ogundipe Sola Taiwo
Quoted 6 lines

Hi everyone,

My name is Sola Ogundipe. I'm an Outreachy applicant for the December 2026 round. I've cloned and setup the repo locally and also played around with adding a git command following the "My First Contribution Tutorial".

Hello Sola,

Welcome to the Git project and thanks for your interest to the Git project.

Quoted 7 lines

I'd like to work on modernizing the 5 occurences of file check in the t5300-pack-object.sh file. I've checked the public inbox and found no one working on fixing the same issue for this file.

Please let me know if I should proceed with the changes.

You can work on it.

Quoted 3 lines

Best regards,
Sola

Thanks.

#4 lore raw

PATCH v2 1/1 t5300: modernize test path checks in t5300

In reply to Ogundipe Sola Taiwo

Improves test t5300-pack-object by converting old-style path checks to use the test_path_is_file helper function.

---
Changes in v2:
- Rephrase patch summary to remove redundant wording

 t/t5300-pack-object.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
t/t5300-pack-object.sh +5 -5
index aac139e6a0..e5ce478484 100755
@@ -283,11 +283,11 @@ test_expect_success 'survive missing objects/pack directory' '
 		GOP=.git/objects/pack &&
 		rm -fr $GOP &&
 		git index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.pack &&
+		test_path_is_file $GOP/pack-${packname_3}.pack &&
 		cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.idx &&
+		test_path_is_file $GOP/pack-${packname_3}.idx &&
 		cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&
-		test -f $GOP/pack-${packname_3}.keep
+		test_path_is_file $GOP/pack-${packname_3}.keep
 	)
 '
 
@@ -376,7 +376,7 @@ test_expect_success 'build pack index for an existing pack' '
 	rm -f test-4.keep &&
 	git index-pack --keep=why test-4.pack &&
 	cmp test-1-${packname_1}.idx test-4.idx &&
-	test -f test-4.keep &&
+	test_path_is_file test-4.keep &&
 
 	:
 '
@@ -616,7 +616,7 @@ test_expect_success 'setup: fake a SHA1 hash collision' '
 		cd corrupt &&
 		long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
 		long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
-		test -f	.git/objects/$long_b &&
+		test_path_is_file .git/objects/$long_b &&
 		cp -f	.git/objects/$long_a \
 			.git/objects/$long_b
 	)

Range-diff against v1:
1: ca6cd5870e = 1: ca6cd5870e t5300: modernize test path checks in t5300 --
2.56.0.116.g6de20f6092.dirty

#5 lore raw

Re: [PATCH v2] t5300: modernize test path checks in t5300

Quoted 2 lines

Improves test t5300-pack-object by converting old-style

Looks good now. Thanks.

#6 lore raw

Re: [PATCH v2] t5300: modernize test path checks in t5300

In reply to Ogundipe Sola Taiwo
Quoted 2 lines · Ogundipe Sola Taiwo

Improves test t5300-pack-object by converting old-style path checks to use the test_path_is_file helper function.

"Improves" -> "Improve". It would be nicer to state how use of the helper improves.

See similar test updates from others and review comment on them in the past 4 weeks from the list archive.

Thanks.

Quoted 51 lines

---
Changes in v2:
- Rephrase patch summary to remove redundant wording

 t/t5300-pack-object.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
t/t5300-pack-object.sh +5 -5
index aac139e6a0..e5ce478484 100755
@@ -283,11 +283,11 @@ test_expect_success 'survive missing objects/pack directory' '
 		GOP=.git/objects/pack &&
 		rm -fr $GOP &&
 		git index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.pack &&
+		test_path_is_file $GOP/pack-${packname_3}.pack &&
 		cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.idx &&
+		test_path_is_file $GOP/pack-${packname_3}.idx &&
 		cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&
-		test -f $GOP/pack-${packname_3}.keep
+		test_path_is_file $GOP/pack-${packname_3}.keep
 	)
 '
 
@@ -376,7 +376,7 @@ test_expect_success 'build pack index for an existing pack' '
 	rm -f test-4.keep &&
 	git index-pack --keep=why test-4.pack &&
 	cmp test-1-${packname_1}.idx test-4.idx &&
-	test -f test-4.keep &&
+	test_path_is_file test-4.keep &&
 
 	:
 '
@@ -616,7 +616,7 @@ test_expect_success 'setup: fake a SHA1 hash collision' '
 		cd corrupt &&
 		long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
 		long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
-		test -f	.git/objects/$long_b &&
+		test_path_is_file .git/objects/$long_b &&
 		cp -f	.git/objects/$long_a \
 			.git/objects/$long_b
 	)

Range-diff against v1:
1: ca6cd5870e = 1: ca6cd5870e t5300: modernize test path checks in t5300 --
2.56.0.116.g6de20f6092.dirty

#7 lore raw
In reply to Ogundipe Sola Taiwo
Quoted 5 lines

Could you rephrase this to avoid “This commit”? It's redundant in a commit message."
Please describe the change directly instead. Also, I believe, the term patch is more
appropriate and not "commit".

Thanks for catching that. I've rephrased it.

#8 lore raw
In reply to Ogundipe Sola Taiwo
Quoted 5 lines

"Improves" -> "Improve". It would be nicer to state how use of the helper improves.

See similar test updates from others and review comment on them in the past 4 weeks from the list archive.

Will do. Thanks

Quoted 1 line

Thanks.

#9 lore raw

PATCH v3 1/1 t5300: modernize test path checks in t5300

In reply to Ogundipe Sola Taiwo

Replace test -f commands with test_path_is_file, because it makes debugging a failing test easier by reporting what expectation was not met.

---
Changes in v3:
- Rephrase patch summary to state how the use of test_path_is_file improves the debugging of failing tests.

 t/t5300-pack-object.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
t/t5300-pack-object.sh +5 -5
index aac139e6a0..e5ce478484 100755
@@ -283,11 +283,11 @@ test_expect_success 'survive missing objects/pack directory' '
 		GOP=.git/objects/pack &&
 		rm -fr $GOP &&
 		git index-pack --stdin --keep=test <../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.pack &&
+		test_path_is_file $GOP/pack-${packname_3}.pack &&
 		cmp $GOP/pack-${packname_3}.pack ../test-3-${packname_3}.pack &&
-		test -f $GOP/pack-${packname_3}.idx &&
+		test_path_is_file $GOP/pack-${packname_3}.idx &&
 		cmp $GOP/pack-${packname_3}.idx ../test-3-${packname_3}.idx &&
-		test -f $GOP/pack-${packname_3}.keep
+		test_path_is_file $GOP/pack-${packname_3}.keep
 	)
 '
 
@@ -376,7 +376,7 @@ test_expect_success 'build pack index for an existing pack' '
 	rm -f test-4.keep &&
 	git index-pack --keep=why test-4.pack &&
 	cmp test-1-${packname_1}.idx test-4.idx &&
-	test -f test-4.keep &&
+	test_path_is_file test-4.keep &&
 
 	:
 '
@@ -616,7 +616,7 @@ test_expect_success 'setup: fake a SHA1 hash collision' '
 		cd corrupt &&
 		long_a=$(git hash-object -w ../a | sed -e "s!^..!&/!") &&
 		long_b=$(git hash-object -w ../b | sed -e "s!^..!&/!") &&
-		test -f	.git/objects/$long_b &&
+		test_path_is_file .git/objects/$long_b &&
 		cp -f	.git/objects/$long_a \
 			.git/objects/$long_b
 	)

Range-diff against v2:
1: ca6cd5870e ! 1: bbce4f6440 t5300: modernize test path checks in t5300
@@ Metadata
## Commit message ##
t5300: modernize test path checks in t5300

- Improves test t5300-pack-object by converting old-style
- path checks to use the test_path_is_file helper function.
+ Replace test -f commands with test_path_is_file, because
+ it makes debugging a failing test easier by reporting what
+ expectation was not met.

--
2.56.0.116.g6de20f6092.dirty

#10 lore raw

Re: [PATCH v3] t5300: modernize test path checks in t5300

Quoted 4 lines · Ogundipe Sola Taiwo

Replace test -f commands with test_path_is_file, because it makes debugging a failing test easier by reporting what expectation was not met.

Quoted 8 lines

---
Changes in v3:
- Rephrase patch summary to state how the use of test_path_is_file improves the debugging of failing tests.

 t/t5300-pack-object.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Will queue. Thanks.