public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
@ 2026-03-13 13:34 aum2357
  0 siblings, 0 replies; 6+ messages in thread
From: aum2357 @ 2026-03-13 13:34 UTC (permalink / raw)
  To: git; +Cc: aum2357

diff: use conventional comparison order

Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
to follow the common coding style where variables appear on the
left side of comparisons.
---
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index 0ee21692c2..ad0d6047af 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -432,7 +432,7 @@ int cmd_add(int argc,
 	argc--;
 	argv++;
 
-	if (0 <= addremove_explicit)
+	if ( addremove_explicit >= 0 )
 		addremove = addremove_explicit;
 	else if (take_worktree_changes && ADDREMOVE_DEFAULT)
 		addremove = 0; /* "-u" was given but not "-A" */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
@ 2026-03-13 13:39 aum2357
  2026-03-13 14:41 ` Collin Funk
  0 siblings, 1 reply; 6+ messages in thread
From: aum2357 @ 2026-03-13 13:39 UTC (permalink / raw)
  To: git; +Cc: aum2357

diff: use conventional comparison order

Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
to follow the common coding style where variables appear on the
left side of comparisons.
---
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index 0ee21692c2..ad0d6047af 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -432,7 +432,7 @@ int cmd_add(int argc,
 	argc--;
 	argv++;
 
-	if (0 <= addremove_explicit)
+	if ( addremove_explicit >= 0 )
 		addremove = addremove_explicit;
 	else if (take_worktree_changes && ADDREMOVE_DEFAULT)
 		addremove = 0; /* "-u" was given but not "-A" */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
@ 2026-03-13 13:55 aum2357
  0 siblings, 0 replies; 6+ messages in thread
From: aum2357 @ 2026-03-13 13:55 UTC (permalink / raw)
  To: git; +Cc: aum2357

diff: use conventional comparison order

Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
to follow the common coding style where variables appear on the
left side of comparisons.
---
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index 0ee21692c2..ad0d6047af 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -432,7 +432,7 @@ int cmd_add(int argc,
 	argc--;
 	argv++;
 
-	if (0 <= addremove_explicit)
+	if ( addremove_explicit >= 0 )
 		addremove = addremove_explicit;
 	else if (take_worktree_changes && ADDREMOVE_DEFAULT)
 		addremove = 0; /* "-u" was given but not "-A" */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
@ 2026-03-13 13:58 aum2357
  0 siblings, 0 replies; 6+ messages in thread
From: aum2357 @ 2026-03-13 13:58 UTC (permalink / raw)
  To: git; +Cc: aum2357

diff: use conventional comparison order

Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
to follow the common coding style where variables appear on the
left side of comparisons.
---
 builtin/add.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index 0ee21692c2..ad0d6047af 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -432,7 +432,7 @@ int cmd_add(int argc,
 	argc--;
 	argv++;
 
-	if (0 <= addremove_explicit)
+	if ( addremove_explicit >= 0 )
 		addremove = addremove_explicit;
 	else if (take_worktree_changes && ADDREMOVE_DEFAULT)
 		addremove = 0; /* "-u" was given but not "-A" */
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
  2026-03-13 13:39 [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com> aum2357
@ 2026-03-13 14:41 ` Collin Funk
  2026-03-13 17:43   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Collin Funk @ 2026-03-13 14:41 UTC (permalink / raw)
  To: aum2357; +Cc: git

aum2357 <ahambrahmasmi2357@gmail.com> writes:

> diff: use conventional comparison order
>
> Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
> to follow the common coding style where variables appear on the
> left side of comparisons.
> ---
>  builtin/add.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/add.c b/builtin/add.c
> index 0ee21692c2..ad0d6047af 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -432,7 +432,7 @@ int cmd_add(int argc,
>  	argc--;
>  	argv++;
>  
> -	if (0 <= addremove_explicit)
> +	if ( addremove_explicit >= 0 )
>  		addremove = addremove_explicit;
>  	else if (take_worktree_changes && ADDREMOVE_DEFAULT)
>  		addremove = 0; /* "-u" was given but not "-A" */

See a previous thread on this topic [1].

We have a dead link in the Coreutils README-hacking that is likely to
that thread. We also generally prefer the previous ordering there.

Collin

[1] https://public-inbox.org/git/7vekbwru6x.fsf@assigned-by-dhcp.cox.net/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>
  2026-03-13 14:41 ` Collin Funk
@ 2026-03-13 17:43   ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2026-03-13 17:43 UTC (permalink / raw)
  To: Collin Funk; +Cc: aum2357, git

Collin Funk <collin.funk1@gmail.com> writes:

> Subject: Re: [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com>

The commit title is not where sign-off is made.

> aum2357 <ahambrahmasmi2357@gmail.com> writes:
>
>> diff: use conventional comparison order

The first line of the commit body begins with "diff:" but the patch
is about "add".

>> Replace `0 <= addremove_explicit` with `addremove_explicit >= 0`
>> to follow the common coding style where variables appear on the
>> left side of comparisons.
>> ---
>>  builtin/add.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/builtin/add.c b/builtin/add.c
>> index 0ee21692c2..ad0d6047af 100644
>> --- a/builtin/add.c
>> +++ b/builtin/add.c
>> @@ -432,7 +432,7 @@ int cmd_add(int argc,
>>  	argc--;
>>  	argv++;
>>  
>> -	if (0 <= addremove_explicit)
>> +	if ( addremove_explicit >= 0 )
> ... We also generally prefer the previous ordering there.

CodingGuidelines say that "We prefer a space between the function
name and the parentheses, and no space inside the parentheses.".  

It also says that "less stable value on the left hand side" and
"textual order match the actual order of values" are both valid ways
to write comparisons, and concludes "Just do not mix styles in the
same part of the code and mimic existing styles in the
neighbourhood."

And as you point out, I think this file prefers the "textual order
matches actual order" style (there is only one violation of it in
the file, if I counted correctly, in prune_directory()).

Many things in this patch contradicts the coding guidelines X-<.  I
wish if the vger mailing list can use some e-mail lint installed to
bounce a patch e-mail that ignores our guides like CodingGuidelines
and SubmittingPatches before it reaches the list to the author, with
explanation.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-13 17:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-13 13:39 [PATCH] Signed-off-by: aum2357 <ahambrahmasmi2357@gmail.com> aum2357
2026-03-13 14:41 ` Collin Funk
2026-03-13 17:43   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2026-03-13 13:58 aum2357
2026-03-13 13:55 aum2357
2026-03-13 13:34 aum2357

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox