Skip to contentSkip to conversation

test-lib-functions.sh : change test_i18ngrep to test_grep

PATCH In review Shreyansh Paliwal 4 participants 10 messages Dec 2, 2023 – Dec 18, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-lib-functions.sh : change test_i18ngrep to test_grep

Recently the test_i18ngrep was deprecated from the source code and test_grep was implemented but in the test-lib-functions.sh file , in the test_grep() function definition,
it is written BUG "too few parameters to test_i18ngrep". So the following patch solves the minor problem.

---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertions(+), 1 deletions(-)
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)diff --git

a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 9c3cf12b26..8737c95e0c 100644
--- a/t/test-lib-functions.sh

t/test-lib-functions.sh +1 -1
@@ -1277,7 +1277,7 @@ test_grep () {
        if test $# -lt 2 ||
           { test "x!" = "x$1" && test $# -lt 3 ; }
        then
-               BUG "too few parameters to test_i18ngrep"
+               BUG "too few parameters to test_grep"
        fi
 
        if test "x!" = "x$1"

--
2.43

#1 lore raw
Quoted 1 line · Shreyansh Paliwal

Subject: [Patch] test-lib-functions.sh : change test_i18ngrep to test_grep

For anyone reading the subject, I think reading

change test_i18ngrep to test_grep

would be confusing, as from the looks of it, the patch does remove test_i18ngrep() and replace it with test_grep (I mean the plan is to remove test_i18ngrep only after we are sure that it doesn't exist in the code anywhere, anymore) but only making a change in the wording of an error message within test_grep().

Also I think we can drop the SP after "related topic" part of the patch and the colon (but have the SP after the colon), that is

	"test-lib-functions.sh: ..."

Also, nit, but I think we should have [PATCH] instead of [Patch]. I'm not really sure if Junio's setup treats [PATCH] and [Patch] to be same :)

Quoted 3 lines

Recently the test_i18ngrep was deprecated from the source code and test_grep was implemented but in the test-lib-functions.sh file , in the test_grep() function definition,

This recent deprecation was made in the commit,
2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31) and it makes sense to include it in the commit message as the following change is essentially something that the previous commit seems to have forgotten to do.

Quoted 1 line

it is written BUG "too few parameters to test_i18ngrep".

I think it is not necessary to mention what is the current code in _this case_ as it can be read in the change itself :)

Quoted 1 line

So the following patch solves the minor problem.

What exactly is the problem? I think it should be mentioned in the commit message that the wording of the error message causes confusion ;) as when test_grep() is used in a test and this test fails. That the change is - it would be clear to see

"too few parameters to test_grep"

instead of

"too few parameters to test_i18ngrep"

Quoted 22 lines
---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertions(+), 1 deletions(-)
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)diff --git

a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 9c3cf12b26..8737c95e0c 100644
--- a/t/test-lib-functions.sh

t/test-lib-functions.sh +1 -2
@@ -1277,7 +1277,7 @@ test_grep () {
        if test $# -lt 2 ||
           { test "x!" = "x$1" && test $# -lt 3 ; }
        then
-               BUG "too few parameters to test_i18ngrep"
+               BUG "too few parameters to test_grep"
        fi
 
        if test "x!" = "x$1"
--
Quoted 1 line

2.43

The diff format doesn't seem proper (some repeated lines and no newlines at the required places).

If you have no go-to tool to send patches through email then git-send-email is a really good tool to do it. It handles most of the work for you. "MyFirstContribution" has a guide to do so

https://git-send-email.io/ (also has setup with GMail)
https://git-scm.com/docs/MyFirstContribution#howto-git-send-email

Another good resource which is not linked often is

https://flusp.ime.usp.br/git/sending-patches-by-email-with-git/

by Matheus Tavares, also a Git Contributor. It also has other useful links which are worth a read.

Thanks

#2 lore raw
Quoted 6 lines · Kousik Sanagavarapu
Quoted 1 line · Shreyansh Paliwal

Subject: [Patch] test-lib-functions.sh : change test_i18ngrep to test_grep

For anyone reading the subject, I think reading

Quoted 7 lines

change test_i18ngrep to test_grep

would be confusing, as from the looks of it, the patch does remove test_i18ngrep() and replace it with test_grep (I mean the plan is to remove test_i18ngrep only after we are sure that it doesn't exist in the code anywhere, anymore) but only making a change in the wording of an error message within test_grep().

;-)

Yes, that was exactly my reaction to the subject (I'm on vacation so I only scanned the subject lines of incoming patches without looking at anything else and thought "hmph, it is good somebody else is cleaning up new uses of test_i18ngrep that have been introduced by topics simultaneously in flight").

#3 lore raw

PATCH v2 1/1 test-lib-functions.sh: fix test_grep fail message wording

In reply to Shreyansh Paliwal

From: shreyp135 <[email protected]>

In the recent commit
2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31), the test_i18ngrep() function was deprecated.

So if a test employing this function fails,
the error messages may be confusing due to wording issues.

It's important to address these wording changes to ensure smooth transitions for developers adapting to the deprecation of test_i18ngrep,
and to maintain the effectiveness of the testing process.

---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/test-lib-functions.sh +1 -1
index 9c3cf12b26..8737c95e0c 100644
@@ -1277,7 +1277,7 @@ test_grep () {
 	if test $# -lt 2 ||
 	   { test "x!" = "x$1" && test $# -lt 3 ; }
 	then
-		BUG "too few parameters to test_i18ngrep"
+		BUG "too few parameters to test_grep"
 	fi
 
 	if test "x!" = "x$1"
Signature · 1 line
2.43.0.1
#4 lore raw

Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording

Quoted 5 lines · Shreyansh Paliwal

From: shreyp135 <[email protected]>

In the recent commit
2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31), the test_i18ngrep() function was deprecated.

s/In the/In a

is gramatically correct, but probably not worth a reroll.

Quoted 2 lines

So if a test employing this function fails,
the error messages may be confusing due to wording issues.

Isn't the confusion due to test_i18ngrep being displayed in place of test_grep and not the other way around? Because the formation of the sentence makes it look like the latter.

Quoted 24 lines

It's important to address these wording changes to ensure smooth transitions for developers adapting to the deprecation of test_i18ngrep,
and to maintain the effectiveness of the testing process.

---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/test-lib-functions.sh +1 -1
index 9c3cf12b26..8737c95e0c 100644
@@ -1277,7 +1277,7 @@ test_grep () {
 	if test $# -lt 2 ||
 	   { test "x!" = "x$1" && test $# -lt 3 ; }
 	then
-		BUG "too few parameters to test_i18ngrep"
+		BUG "too few parameters to test_grep"
 	fi
 
 	if test "x!" = "x$1"
Signature · 1 line
2.43.0.1

Rest looks good.

Have a great time at the vacation Junio (and sorry for pinging in the first place... although this email will indirectly ping too :P).

Thanks

#6 lore raw

Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording

Quoted 1 line · Shreyansh Paliwal

ping.

Junio was on vacation at the time[1] that this patch was submitted, so it's quite possible that it simply got overlooked or he hasn't gotten through the backlog of emails which accumulated while he was away. So, pinging is indeed the correct thing to do, and the patch is obviously an improvement, so hopefully it will be picked up soon.

[1]: https://lore.kernel.org/git/[email protected]/

#7 lore raw

Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording

Quoted 7 lines · Eric Sunshine
Quoted 1 line · Shreyansh Paliwal

ping.

Junio was on vacation at the time[1] that this patch was submitted, so it's quite possible that it simply got overlooked or he hasn't gotten through the backlog of emails which accumulated while he was away.

It was dropped due to automated filter that noticed that the address on its in-body From: line does not appear on any of its Signed-off-by:
line ;-)

I'll see if that is the only glitch in the patch (in which case I'll manually adjust the authorship and apply) or respond on list (otherwise).

Thanks for pinging and ponging.

Quoted 5 lines

So,
pinging is indeed the correct thing to do, and the patch is obviously an improvement, so hopefully it will be picked up soon.

[1]: https://lore.kernel.org/git/[email protected]/

#8 lore raw

Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording

Quoted 5 lines · Junio C Hamano

I'll see if that is the only glitch in the patch (in which case I'll manually adjust the authorship and apply) or respond on list (otherwise).

Thanks for pinging and ponging.

Here is the version I queued.
Thanks, both.

--- >8 ---
From: Shreyansh Paliwal <[email protected]>
Date: Sun, 3 Dec 2023 22:47:59 +0530
Subject: [PATCH] test-lib-functions.sh: fix test_grep fail message wording

In the recent commit 2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31), the test_i18ngrep function was deprecated, and all the callers were updated to call the test_grep function instead. But test_grep inherited an error message that still refers to test_i18ngrep by mistake. Correct it so that a broken call to the test_grep will identify itself as such.

---
 t/test-lib-functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/test-lib-functions.sh +1 -1
index c50bc18861..502f892fad 100644
@@ -1222,7 +1222,7 @@ test_grep () {
 	if test $# -lt 2 ||
 	   { test "x!" = "x$1" && test $# -lt 3 ; }
 	then
-		BUG "too few parameters to test_i18ngrep"
+		BUG "too few parameters to test_grep"
 	fi
 
 	if test "x!" = "x$1"
Signature · 1 line
2.43.0-76-g1a87c842ec
#9 lore raw

Re: [PATCH v2] test-lib-functions.sh: fix test_grep fail message wording

Quoted 7 lines · Junio C Hamano

Here is the version I queued.

--- >8 ---
From: Shreyansh Paliwal <[email protected]>
Date: Sun, 3 Dec 2023 22:47:59 +0530
Subject: [PATCH] test-lib-functions.sh: fix test_grep fail message wording

Quoted 6 lines

In the recent commit 2e87fca189 (test framework: further deprecate test_i18ngrep, 2023-10-31), the test_i18ngrep function was deprecated, and all the callers were updated to call the test_grep function instead. But test_grep inherited an error message that still refers to test_i18ngrep by mistake. Correct it so that a broken call to the test_grep will identify itself as such.

This rewritten commit message gets directly to the point without wasted words, making the purpose of the patch, and its justification, easier to understand on first read. Nicely done.

Quoted 2 lines