threads / patch / 65056

patchrepo: Remove unnecessary variable shadow

Subject: [PATCH GSoC] repo: Remove unnecessary variable shadow

## tl;dr

4 messages between Feb 23, 2026 and Feb 27, 2026. Diffs are folded; open one to read it.

replies: 3people: 3as markdown or json

K Jayatheerth· Feb 23, 2026, 13:52 UTC · lore

Avoid redeclaring `entry` inside the conditional block, removing unnecessary variable shadowing and improving code clarity without changing behavior.

Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
---
 builtin/repo.c | 1 -
 1 file changed, 1 deletion(-)
Show changes to builtin/repo.c +0 −1
diff --git a/builtin/repo.c b/builtin/repo.c
index 0ea045abc1..5540bd25d2 100644
--- a/builtin/repo.c
+++ b/builtin/repo.c
@@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)
 		const char *unit = "";
 
 		if (entry) {
-			struct stats_table_entry *entry = item->util;
 			value = entry->value;
 			if (entry->unit)
 				unit = entry->unit;
-- 
2.53.0
Justin Tobler· Feb 23, 2026, 15:32 UTC · re: K Jayatheerth · lore

Re: [PATCH GSoC] repo: Remove unnecessary variable shadow

On 26/02/23 07:22PM, K Jayatheerth wrote:
Show 18 quoted lines
> Avoid redeclaring `entry` inside the conditional block, removing
> unnecessary variable shadowing and improving code clarity without
> changing behavior.
> 
> Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
> ---
>  builtin/repo.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/builtin/repo.c b/builtin/repo.c
> index 0ea045abc1..5540bd25d2 100644
> --- a/builtin/repo.c
> +++ b/builtin/repo.c
> @@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)
>  		const char *unit = "";
>  
>  		if (entry) {
> -			struct stats_table_entry *entry = item->util;
Yup, this is indeed redundant. Thanks for cleaning up after me.
-Justin
Junio C Hamano· Feb 27, 2026, 19:11 UTC · re: JAYATHEERTH K · lore

Re: [PATCH GSoC] repo: Remove unnecessary variable shadow

JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:
> I got a review on this patch,
> if no one has an issue I wanted to remind it for the next cycle.
Thanks.

An easier way to ping is to resubmit exactly the same patch, with reviewed-by: or acked-by: trailer crediting the reviewer. We have 2000+ messages in 4 weeks, so "I got a review on this patch" without a pointer is much less useful to verify what feedback came to the thread from whom. FYI here are from the headers of the message I am responding to.

    References: <20260223135248.127935-1-jayatheerthkulkarni2005@gmail.com>
    Message-ID: <CA+rGoLeppg4Xaoqg6+SZ=ET=ze6rXUbmjLm5UvmitmRGm9u6ag@mail.gmail.com>

The reference points at the patch itself, and just like Git commits do not have pointers to their children, the original patch message has no links to reviews on it X-<.

I'll commit this with the following change now.
Thanks.
1:  006c49ee01 ! 1:  a66c8c7f91 repo: Remove unnecessary variable shadow
    @@ Metadata
     Author: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
     
      ## Commit message ##
    -    repo: Remove unnecessary variable shadow
    +    repo: remove unnecessary variable shadow
     
         Avoid redeclaring `entry` inside the conditional block, removing
         unnecessary variable shadowing and improving code clarity without
         changing behavior.
     
         Signed-off-by: K Jayatheerth <jayatheerthkulkarni2005@gmail.com>
    +    Acked-by: Justin Tobler <jltobler@gmail.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
      ## builtin/repo.c ##

← back to recent threads