* [PATCH] [GSoC][PATCH] t9160:modernize test path checking
@ 2026-01-05 14:59 Hoda Salim via GitGitGadget
2026-02-02 16:18 ` [PATCH v2][GSoC] " Hoda Salim
0 siblings, 1 reply; 6+ messages in thread
From: Hoda Salim via GitGitGadget @ 2026-01-05 14:59 UTC (permalink / raw)
To: git; +Cc: Hoda Salim, HodaSalim
From: HodaSalim <hoda.s.salim@gmail.com>
Replace old-style path checks with Git's dedicated test helpers:
- test -f → test_path_is_file
- test -d → test_path_is_dir
- test -s → test_file_not_empty
Found using: git grep "test -[efd]" t/
This improves test readability and provides better error messages
when path checks fail.
Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
---
[GSoC][PATCH] t9160:modernize test path checking
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2160%2FHodaSalim%2Fmicroproject%2Fmodernize-t9160-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2160/HodaSalim/microproject/modernize-t9160-v1
Pull-Request: https://github.com/git/git/pull/2160
t/t9160-git-svn-preserve-empty-dirs.sh | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh
index 36c6b1a12f..b89c1cb93a 100755
--- a/t/t9160-git-svn-preserve-empty-dirs.sh
+++ b/t/t9160-git-svn-preserve-empty-dirs.sh
@@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
# "$GIT_REPO"/1 should only contain the placeholder file.
test_expect_success 'directory empty from inception' '
- test -f "$GIT_REPO"/1/.gitignore &&
+ test_path_is_file "$GIT_REPO"/1/.gitignore &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
'
# "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
test_expect_success 'directory empty from subsequent svn commit' '
- test -f "$GIT_REPO"/2/.gitignore &&
+ test_path_is_file "$GIT_REPO"/2/.gitignore &&
test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/3/.gitignore &&
+ test_path_is_file "$GIT_REPO"/3/.gitignore &&
test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
'
@@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' '
# generated for every sub-directory at some point in the repo's history.
test_expect_success 'add entry to previously empty directory' '
test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/4/a/b/c/foo
+ test_path_is_file "$GIT_REPO"/4/a/b/c/foo
'
# The HEAD~2 commit should not have introduced .gitignore placeholder files.
@@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' '
# "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
test_expect_success 'placeholder namespace conflict with file' '
- test -s "$GIT_REPO"/5/.placeholder
+ test_file_not_empty "$GIT_REPO"/5/.placeholder
'
# "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
# should only contain one file: the placeholder.
test_expect_success 'placeholder namespace conflict with directory' '
- test -d "$GIT_REPO"/6/.placeholder &&
- test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
+ test_path_is_dir "$GIT_REPO"/6/.placeholder &&
+ test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
'
@@ -134,18 +134,18 @@ test_expect_success 'second set of svn commits and rebase' '
# Check that --preserve-empty-dirs and --placeholder-file flag state
# stays persistent over multiple invocations.
test_expect_success 'flag persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/7/.placeholder &&
+ test_path_is_file "$GIT_REPO"/7/.placeholder &&
test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
'
# Check that placeholder files are properly removed when unnecessary,
# even across multiple invocations.
test_expect_success 'placeholder list persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/1/file1.txt &&
+ test_path_is_file "$GIT_REPO"/1/file1.txt &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/5/file1.txt &&
- test -f "$GIT_REPO"/5/.placeholder &&
+ test_path_is_file "$GIT_REPO"/5/file1.txt &&
+ test_path_is_file "$GIT_REPO"/5/.placeholder &&
test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
'
base-commit: 68cb7f9e92a5d8e9824f5b52ac3d0a9d8f653dbe
--
gitgitgadget
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2][GSoC] t9160:modernize test path checking
2026-01-05 14:59 [PATCH] [GSoC][PATCH] t9160:modernize test path checking Hoda Salim via GitGitGadget
@ 2026-02-02 16:18 ` Hoda Salim
2026-02-02 19:00 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Hoda Salim @ 2026-02-02 16:18 UTC (permalink / raw)
To: git; +Cc: HodaSalim
From: HodaSalim <hoda.s.salim@gmail.com>
Replace old-style path checks with Git's dedicated test helpers:
- test -f → test_path_is_file
- test -d → test_path_is_dir
- test -s → test_file_not_empty
Fix typos with the word "subsequent"
Found using: git grep "test -[efd]" t/
This improves test readability and provides better error messages
when path checks fail.
Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
---
t/t9160-git-svn-preserve-empty-dirs.sh | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh
index 36c6b1a12f..de32cf2542 100755
--- a/t/t9160-git-svn-preserve-empty-dirs.sh
+++ b/t/t9160-git-svn-preserve-empty-dirs.sh
@@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
# "$GIT_REPO"/1 should only contain the placeholder file.
test_expect_success 'directory empty from inception' '
- test -f "$GIT_REPO"/1/.gitignore &&
+ test_path_is_file "$GIT_REPO"/1/.gitignore &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
'
# "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
test_expect_success 'directory empty from subsequent svn commit' '
- test -f "$GIT_REPO"/2/.gitignore &&
+ test_path_is_file "$GIT_REPO"/2/.gitignore &&
test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/3/.gitignore &&
+ test_path_is_file "$GIT_REPO"/3/.gitignore &&
test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
'
@@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' '
# generated for every sub-directory at some point in the repo's history.
test_expect_success 'add entry to previously empty directory' '
test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/4/a/b/c/foo
+ test_path_is_file "$GIT_REPO"/4/a/b/c/foo
'
# The HEAD~2 commit should not have introduced .gitignore placeholder files.
@@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' '
# "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
test_expect_success 'placeholder namespace conflict with file' '
- test -s "$GIT_REPO"/5/.placeholder
+ test_file_not_empty "$GIT_REPO"/5/.placeholder
'
# "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
# should only contain one file: the placeholder.
test_expect_success 'placeholder namespace conflict with directory' '
- test -d "$GIT_REPO"/6/.placeholder &&
- test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
+ test_path_is_dir "$GIT_REPO"/6/.placeholder &&
+ test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
'
@@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' '
# Check that --preserve-empty-dirs and --placeholder-file flag state
# stays persistent over multiple invocations.
-test_expect_success 'flag persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/7/.placeholder &&
+test_expect_success 'flag persistence during subsequent rebase' '
+ test_path_is_file "$GIT_REPO"/7/.placeholder &&
test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
'
# Check that placeholder files are properly removed when unnecessary,
# even across multiple invocations.
-test_expect_success 'placeholder list persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/1/file1.txt &&
+test_expect_success 'placeholder list persistence during subsequent rebase' '
+ test_path_is_file "$GIT_REPO"/1/file1.txt &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/5/file1.txt &&
- test -f "$GIT_REPO"/5/.placeholder &&
+ test_path_is_file "$GIT_REPO"/5/file1.txt &&
+ test_path_is_file "$GIT_REPO"/5/.placeholder &&
test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
'
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2][GSoC] t9160:modernize test path checking
2026-02-02 16:18 ` [PATCH v2][GSoC] " Hoda Salim
@ 2026-02-02 19:00 ` Junio C Hamano
2026-02-02 19:34 ` Hoda Salim
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2026-02-02 19:00 UTC (permalink / raw)
To: Hoda Salim; +Cc: git
Hoda Salim <hoda.s.salim@gmail.com> writes:
> From: HodaSalim <hoda.s.salim@gmail.com>
>
> Replace old-style path checks with Git's dedicated test helpers:
> - test -f → test_path_is_file
> - test -d → test_path_is_dir
> - test -s → test_file_not_empty
>
> Fix typos with the word "subsequent"
>
> Found using: git grep "test -[efd]" t/
>
> This improves test readability and provides better error messages
> when path checks fail.
For a small change like this, the above is sufficient as all the
necessary things are described, but for future reference, we prefer
to explain things in this order:
- Give an observation on how the current system works in the
present tense (so no need to say "Currently X is Y", or
"Previously X was Y" to describe the state before your change;
just "X is Y" is enough), and discuss what you perceive as a
problem in it.
- Propose a solution (optional---often, problem description
trivially leads to an obvious solution in reader's minds).
- Give commands to somebody editing the codebase to "make it so",
instead of saying "This commit does X".
You are going backwards ;-).
Will queue. Thanks (and thanks for all the reviewers who helped
polish the draft to get to this v2).
>
> Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
> ---
> t/t9160-git-svn-preserve-empty-dirs.sh | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh
> index 36c6b1a12f..de32cf2542 100755
> --- a/t/t9160-git-svn-preserve-empty-dirs.sh
> +++ b/t/t9160-git-svn-preserve-empty-dirs.sh
> @@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
>
> # "$GIT_REPO"/1 should only contain the placeholder file.
> test_expect_success 'directory empty from inception' '
> - test -f "$GIT_REPO"/1/.gitignore &&
> + test_path_is_file "$GIT_REPO"/1/.gitignore &&
> test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
> '
>
> # "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
> test_expect_success 'directory empty from subsequent svn commit' '
> - test -f "$GIT_REPO"/2/.gitignore &&
> + test_path_is_file "$GIT_REPO"/2/.gitignore &&
> test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
> - test -f "$GIT_REPO"/3/.gitignore &&
> + test_path_is_file "$GIT_REPO"/3/.gitignore &&
> test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
> '
>
> @@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' '
> # generated for every sub-directory at some point in the repo's history.
> test_expect_success 'add entry to previously empty directory' '
> test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
> - test -f "$GIT_REPO"/4/a/b/c/foo
> + test_path_is_file "$GIT_REPO"/4/a/b/c/foo
> '
>
> # The HEAD~2 commit should not have introduced .gitignore placeholder files.
> @@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' '
>
> # "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
> test_expect_success 'placeholder namespace conflict with file' '
> - test -s "$GIT_REPO"/5/.placeholder
> + test_file_not_empty "$GIT_REPO"/5/.placeholder
> '
>
> # "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
> # should only contain one file: the placeholder.
> test_expect_success 'placeholder namespace conflict with directory' '
> - test -d "$GIT_REPO"/6/.placeholder &&
> - test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
> + test_path_is_dir "$GIT_REPO"/6/.placeholder &&
> + test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
> test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
> '
>
> @@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' '
>
> # Check that --preserve-empty-dirs and --placeholder-file flag state
> # stays persistent over multiple invocations.
> -test_expect_success 'flag persistence during subsqeuent rebase' '
> - test -f "$GIT_REPO"/7/.placeholder &&
> +test_expect_success 'flag persistence during subsequent rebase' '
> + test_path_is_file "$GIT_REPO"/7/.placeholder &&
> test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
> '
>
> # Check that placeholder files are properly removed when unnecessary,
> # even across multiple invocations.
> -test_expect_success 'placeholder list persistence during subsqeuent rebase' '
> - test -f "$GIT_REPO"/1/file1.txt &&
> +test_expect_success 'placeholder list persistence during subsequent rebase' '
> + test_path_is_file "$GIT_REPO"/1/file1.txt &&
> test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
>
> - test -f "$GIT_REPO"/5/file1.txt &&
> - test -f "$GIT_REPO"/5/.placeholder &&
> + test_path_is_file "$GIT_REPO"/5/file1.txt &&
> + test_path_is_file "$GIT_REPO"/5/.placeholder &&
> test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
> '
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2][GSoC] t9160:modernize test path checking
2026-02-02 19:00 ` Junio C Hamano
@ 2026-02-02 19:34 ` Hoda Salim
0 siblings, 0 replies; 6+ messages in thread
From: Hoda Salim @ 2026-02-02 19:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Pushkar Singh
> Will queue. Thanks (and thanks for all the reviewers who helped
> polish the draft to get to this v2).
Yeah, sorry about that. The patch was initially submitted using
GitGitGadget and I didn't really do a great job in the beginning to
reply to the GitGitGadget email.
Pushkar was the maintainer that kindly pointed out the misspelling. I
added him to the CC for visibility
Thank You,
Hoda
On Mon, Feb 2, 2026 at 9:00 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Hoda Salim <hoda.s.salim@gmail.com> writes:
>
> > From: HodaSalim <hoda.s.salim@gmail.com>
> >
> > Replace old-style path checks with Git's dedicated test helpers:
> > - test -f → test_path_is_file
> > - test -d → test_path_is_dir
> > - test -s → test_file_not_empty
> >
> > Fix typos with the word "subsequent"
> >
> > Found using: git grep "test -[efd]" t/
> >
> > This improves test readability and provides better error messages
> > when path checks fail.
>
> For a small change like this, the above is sufficient as all the
> necessary things are described, but for future reference, we prefer
> to explain things in this order:
>
> - Give an observation on how the current system works in the
> present tense (so no need to say "Currently X is Y", or
> "Previously X was Y" to describe the state before your change;
> just "X is Y" is enough), and discuss what you perceive as a
> problem in it.
>
> - Propose a solution (optional---often, problem description
> trivially leads to an obvious solution in reader's minds).
>
> - Give commands to somebody editing the codebase to "make it so",
> instead of saying "This commit does X".
>
> You are going backwards ;-).
>
> Will queue. Thanks (and thanks for all the reviewers who helped
> polish the draft to get to this v2).
>
>
> >
> > Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
> > ---
> > t/t9160-git-svn-preserve-empty-dirs.sh | 26 +++++++++++++-------------
> > 1 file changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh
> > index 36c6b1a12f..de32cf2542 100755
> > --- a/t/t9160-git-svn-preserve-empty-dirs.sh
> > +++ b/t/t9160-git-svn-preserve-empty-dirs.sh
> > @@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs' '
> >
> > # "$GIT_REPO"/1 should only contain the placeholder file.
> > test_expect_success 'directory empty from inception' '
> > - test -f "$GIT_REPO"/1/.gitignore &&
> > + test_path_is_file "$GIT_REPO"/1/.gitignore &&
> > test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
> > '
> >
> > # "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
> > test_expect_success 'directory empty from subsequent svn commit' '
> > - test -f "$GIT_REPO"/2/.gitignore &&
> > + test_path_is_file "$GIT_REPO"/2/.gitignore &&
> > test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
> > - test -f "$GIT_REPO"/3/.gitignore &&
> > + test_path_is_file "$GIT_REPO"/3/.gitignore &&
> > test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
> > '
> >
> > @@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent svn commit' '
> > # generated for every sub-directory at some point in the repo's history.
> > test_expect_success 'add entry to previously empty directory' '
> > test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
> > - test -f "$GIT_REPO"/4/a/b/c/foo
> > + test_path_is_file "$GIT_REPO"/4/a/b/c/foo
> > '
> >
> > # The HEAD~2 commit should not have introduced .gitignore placeholder files.
> > @@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with --placeholder-file specified' '
> >
> > # "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
> > test_expect_success 'placeholder namespace conflict with file' '
> > - test -s "$GIT_REPO"/5/.placeholder
> > + test_file_not_empty "$GIT_REPO"/5/.placeholder
> > '
> >
> > # "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
> > # should only contain one file: the placeholder.
> > test_expect_success 'placeholder namespace conflict with directory' '
> > - test -d "$GIT_REPO"/6/.placeholder &&
> > - test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
> > + test_path_is_dir "$GIT_REPO"/6/.placeholder &&
> > + test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
> > test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
> > '
> >
> > @@ -133,19 +133,19 @@ test_expect_success 'second set of svn commits and rebase' '
> >
> > # Check that --preserve-empty-dirs and --placeholder-file flag state
> > # stays persistent over multiple invocations.
> > -test_expect_success 'flag persistence during subsqeuent rebase' '
> > - test -f "$GIT_REPO"/7/.placeholder &&
> > +test_expect_success 'flag persistence during subsequent rebase' '
> > + test_path_is_file "$GIT_REPO"/7/.placeholder &&
> > test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
> > '
> >
> > # Check that placeholder files are properly removed when unnecessary,
> > # even across multiple invocations.
> > -test_expect_success 'placeholder list persistence during subsqeuent rebase' '
> > - test -f "$GIT_REPO"/1/file1.txt &&
> > +test_expect_success 'placeholder list persistence during subsequent rebase' '
> > + test_path_is_file "$GIT_REPO"/1/file1.txt &&
> > test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
> >
> > - test -f "$GIT_REPO"/5/file1.txt &&
> > - test -f "$GIT_REPO"/5/.placeholder &&
> > + test_path_is_file "$GIT_REPO"/5/file1.txt &&
> > + test_path_is_file "$GIT_REPO"/5/.placeholder &&
> > test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
> > '
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [GSoC][PATCH] t9160:modernize test path checking
@ 2026-02-02 13:36 Hoda Salim
2026-02-02 13:46 ` [PATCH] [GSoC][PATCH] t9160: modernize " Pushkar Singh
0 siblings, 1 reply; 6+ messages in thread
From: Hoda Salim @ 2026-02-02 13:36 UTC (permalink / raw)
To: git
Hi everyone,
I'm Hoda, and I'm interested in contributing to Git through GSoC 2026.
This is my first patch to the project (my microproject), and I'd
appreciate any feedback on it. The patch modernizes path checks in
t9160 by replacing `test -f`, `test -d`, and `test -s` with Git's
dedicated test helpers for better error messages and consistency. I'm
happy to make any changes if needed!
Thanks,
Hoda
---
Replace old-style path checks with Git's dedicated test helpers:
- test -f → test_path_is_file
- test -d → test_path_is_dir
- test -s → test_file_not_empty
Found using: git grep "test -[efd]" t/
This improves test readability and provides better error messages
when path checks fail.
Signed-off-by: HodaSalim <hoda.s.salim@gmail.com>
---
[GSoC][PATCH] t9160:modernize test path checking
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2160%2FHodaSalim%2Fmicroproject%2Fmodernize-t9160-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git
pr-git-2160/HodaSalim/microproject/modernize-t9160-v1
Pull-Request: https://github.com/git/git/pull/2160
t/t9160-git-svn-preserve-empty-dirs.sh | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/t/t9160-git-svn-preserve-empty-dirs.sh
b/t/t9160-git-svn-preserve-empty-dirs.sh
index 36c6b1a12f..b89c1cb93a 100755
--- a/t/t9160-git-svn-preserve-empty-dirs.sh
+++ b/t/t9160-git-svn-preserve-empty-dirs.sh
@@ -61,15 +61,15 @@ test_expect_success 'clone svn repo with
--preserve-empty-dirs' '
# "$GIT_REPO"/1 should only contain the placeholder file.
test_expect_success 'directory empty from inception' '
- test -f "$GIT_REPO"/1/.gitignore &&
+ test_path_is_file "$GIT_REPO"/1/.gitignore &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1"
'
# "$GIT_REPO"/2 and "$GIT_REPO"/3 should only contain the placeholder file.
test_expect_success 'directory empty from subsequent svn commit' '
- test -f "$GIT_REPO"/2/.gitignore &&
+ test_path_is_file "$GIT_REPO"/2/.gitignore &&
test $(find "$GIT_REPO"/2 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/3/.gitignore &&
+ test_path_is_file "$GIT_REPO"/3/.gitignore &&
test $(find "$GIT_REPO"/3 -type f | wc -l) = "1"
'
@@ -77,7 +77,7 @@ test_expect_success 'directory empty from subsequent
svn commit' '
# generated for every sub-directory at some point in the repo's history.
test_expect_success 'add entry to previously empty directory' '
test $(find "$GIT_REPO"/4 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/4/a/b/c/foo
+ test_path_is_file "$GIT_REPO"/4/a/b/c/foo
'
# The HEAD~2 commit should not have introduced .gitignore placeholder files.
@@ -102,14 +102,14 @@ test_expect_success 'clone svn repo with
--placeholder-file specified' '
# "$GIT_REPO"/5/.placeholder should be a file, and non-empty.
test_expect_success 'placeholder namespace conflict with file' '
- test -s "$GIT_REPO"/5/.placeholder
+ test_file_not_empty "$GIT_REPO"/5/.placeholder
'
# "$GIT_REPO"/6/.placeholder should be a directory, and the "$GIT_REPO"/6 tree
# should only contain one file: the placeholder.
test_expect_success 'placeholder namespace conflict with directory' '
- test -d "$GIT_REPO"/6/.placeholder &&
- test -f "$GIT_REPO"/6/.placeholder/.placeholder &&
+ test_path_is_dir "$GIT_REPO"/6/.placeholder &&
+ test_path_is_file "$GIT_REPO"/6/.placeholder/.placeholder &&
test $(find "$GIT_REPO"/6 -type f | wc -l) = "1"
'
@@ -134,18 +134,18 @@ test_expect_success 'second set of svn commits
and rebase' '
# Check that --preserve-empty-dirs and --placeholder-file flag state
# stays persistent over multiple invocations.
test_expect_success 'flag persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/7/.placeholder &&
+ test_path_is_file "$GIT_REPO"/7/.placeholder &&
test $(find "$GIT_REPO"/7 -type f | wc -l) = "1"
'
# Check that placeholder files are properly removed when unnecessary,
# even across multiple invocations.
test_expect_success 'placeholder list persistence during subsqeuent rebase' '
- test -f "$GIT_REPO"/1/file1.txt &&
+ test_path_is_file "$GIT_REPO"/1/file1.txt &&
test $(find "$GIT_REPO"/1 -type f | wc -l) = "1" &&
- test -f "$GIT_REPO"/5/file1.txt &&
- test -f "$GIT_REPO"/5/.placeholder &&
+ test_path_is_file "$GIT_REPO"/5/file1.txt &&
+ test_path_is_file "$GIT_REPO"/5/.placeholder &&
test $(find "$GIT_REPO"/5 -type f | wc -l) = "2"
'
base-commit: 68cb7f9e92a5d8e9824f5b52ac3d0a9d8f653dbe
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] [GSoC][PATCH] t9160: modernize test path checking
2026-02-02 13:36 [PATCH] [GSoC][PATCH] " Hoda Salim
@ 2026-02-02 13:46 ` Pushkar Singh
0 siblings, 0 replies; 6+ messages in thread
From: Pushkar Singh @ 2026-02-02 13:46 UTC (permalink / raw)
To: hoda.s.salim; +Cc: git
Hi Hoda,
Welcome!
I took a quick look. The replacements with test_path_is_file, test_path_is_dir, and test_file_not_empty look appropriate here, and the patch itself seems straightforward.
Minor nits:
- I noticed "subsqeuent" is misspelled in a couple of the existing test descriptions (not introduced by this patch, but might be a nice follow-up cleanup).
- You might also consider dropping the duplicated [PATCH] tag in the subject for cleanliness.
Otherwise, this looks like a reasonable microproject.
Best,
Pushkar
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-02-02 19:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 14:59 [PATCH] [GSoC][PATCH] t9160:modernize test path checking Hoda Salim via GitGitGadget
2026-02-02 16:18 ` [PATCH v2][GSoC] " Hoda Salim
2026-02-02 19:00 ` Junio C Hamano
2026-02-02 19:34 ` Hoda Salim
-- strict thread matches above, loose matches on Subject: below --
2026-02-02 13:36 [PATCH] [GSoC][PATCH] " Hoda Salim
2026-02-02 13:46 ` [PATCH] [GSoC][PATCH] t9160: modernize " Pushkar Singh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox