public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Tian Yuchen <cat@malon.dev>
To: aum2357 <ahambrahmasmi2357@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH GSOC] diff: use conventional comparison order
Date: Sat, 14 Mar 2026 01:59:28 +0800	[thread overview]
Message-ID: <9afe48e3-8348-4e2c-8e5f-bbdc3b2951f8@malon.dev> (raw)
In-Reply-To: <20260313140440.564201-1-ahambrahmasmi2357@gmail.com>

Hi aum2357,

On 3/13/26 22:04, aum2357 wrote:
> 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" */

I guess this syntax is probably intended to prevent the compiler from 
not reporting an error when someone accidentally types '='. But since 
the code is already written and runs fine, isn't it a bit unnecessary to 
change it?

You can try a command like

> git grep -E ‘\(.*<=.*\)’

to see what happens. The codebase actually includes both, right?



By the way, as far as I know, no country allows numbers to be part of a 
name. In other word, I don't think 'aum2357' is your real name ;)
If you've browsed the mailing list, you'll notice that everyone submits 
patches using their real names. Please adjust yours accordingly.

Regards,

Yuchen

  reply	other threads:[~2026-03-13 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 14:04 [PATCH GSOC] diff: use conventional comparison order aum2357
2026-03-13 17:59 ` Tian Yuchen [this message]
2026-03-13 20:18   ` Junio C Hamano
2026-03-14  3:59     ` Tian Yuchen
2026-03-14 12:27       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9afe48e3-8348-4e2c-8e5f-bbdc3b2951f8@malon.dev \
    --to=cat@malon.dev \
    --cc=ahambrahmasmi2357@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox