{"thread":{"id":"65187","subject":"[PATCH 0/2] repo: remove redundant variable shadow in stats_table_print_structure","startedAt":"2026-03-10T02:17:02Z","lastAt":"2026-03-10T13:08:35Z","messageCount":5,"participants":["Mansi Singh via GitGitGadget","Mansi via GitGitGadget","Junio C Hamano","K Jayatheerth"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"538346","messageId":"pull.2062.git.1773109018.gitgitgadget@gmail.com","threadId":"65187","inReplyTo":null,"subject":"[PATCH 0/2] repo: remove redundant variable shadow in stats_table_print_structure","fromName":"Mansi Singh via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-03-10T02:16:56Z","receivedAt":"2026-03-10T02:17:02Z","isPatch":true,"sender":{"key":"mansimaanu8627@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40687671?v=4"},"body":"The variable i is declared in the outer scope of\nstats_table_print_structure() and then re-declared inside the loop,\nshadowing the outer one unnecessarily. Remove the redundant inner\ndeclaration to clean up the scope.\n\nSigned-off-by: Mansi Singh mansimaanu8627@gmail.com\n\nMansi (1):\n  t7605: use test_path_is_file instead of test -f\n\nMansi Singh (1):\n  repo: remove redundant variable shadow in stats_table_print_structure\n\n builtin/repo.c           | 1 -\n t/t7605-merge-resolve.sh | 6 +++---\n 2 files changed, 3 insertions(+), 4 deletions(-)\n\n\nbase-commit: 7c02d39fc2ed2702223c7674f73150d9a7e61ba4\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2062%2FMansiSingh17%2Frepo-fix-variable-shadow-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2062/MansiSingh17/repo-fix-variable-shadow-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2062\n-- \ngitgitgadget\n"},{"id":"538347","messageId":"11724e9310f30da72d2b60a8bae190a46fbb5269.1773109018.git.gitgitgadget@gmail.com","threadId":"65187","inReplyTo":"pull.2062.git.1773109018.gitgitgadget@gmail.com","subject":"[PATCH 1/2] t7605: use test_path_is_file instead of test -f","fromName":"Mansi via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-03-10T02:16:57Z","receivedAt":"2026-03-10T02:17:03Z","isPatch":true,"sender":{"key":"name:Mansi","avatar":null},"body":"From: Mansi <mansimaanu8627@gmail.com>\n\nReplace old-style 'test -f' path checks with the modern\ntest_path_is_file helper in the merge_c1_to_c2_cmds block.\n\nThe helper provides clearer failure messages and is the\nestablished convention in Git's test suite.\n\nThese instances were found using:\n  grep -rn \"test -[efd]\" t/ --include=\"*.sh\"\n\nSigned-off-by: Mansi <mansimaanu8627@gmail.com>\n---\n t/t7605-merge-resolve.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh\nindex 5d56c38546..44de97a480 100755\n--- a/t/t7605-merge-resolve.sh\n+++ b/t/t7605-merge-resolve.sh\n@@ -34,9 +34,9 @@ merge_c1_to_c2_cmds='\n \ttest \"$(git rev-parse c1)\" = \"$(git rev-parse HEAD^1)\" &&\n \ttest \"$(git rev-parse c2)\" = \"$(git rev-parse HEAD^2)\" &&\n \tgit diff --exit-code &&\n-\ttest -f c0.c &&\n-\ttest -f c1.c &&\n-\ttest -f c2.c &&\n+\ttest_path_is_file c0.c &&\n+\ttest_path_is_file c1.c &&\n+\ttest_path_is_file c2.c &&\n \ttest 3 = $(git ls-tree -r HEAD | wc -l) &&\n \ttest 3 = $(git ls-files | wc -l)\n '\n-- \ngitgitgadget\n\n"},{"id":"538348","messageId":"4adf6d4dca90e2c7f780d594a533c21247c459b8.1773109018.git.gitgitgadget@gmail.com","threadId":"65187","inReplyTo":"pull.2062.git.1773109018.gitgitgadget@gmail.com","subject":"[PATCH 2/2] repo: remove redundant variable shadow in stats_table_print_structure","fromName":"Mansi Singh via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-03-10T02:16:58Z","receivedAt":"2026-03-10T02:17:05Z","isPatch":true,"sender":{"key":"mansimaanu8627@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40687671?v=4"},"body":"From: Mansi Singh <mansimaanu8627@gmail.com>\n\nIn stats_table_print_structure(), the variable 'entry' is declared\nat the top of the loop body and assigned from item->util. Inside\nthe 'if (entry)' block, the same variable is redeclared and assigned\nidentically, shadowing the outer declaration unnecessarily.\n\nRemove the inner redeclaration since the outer 'entry' is already\navailable and non-NULL at that point.\n\nSigned-off-by: Mansi Singh <mansimaanu8627@gmail.com>\n---\n builtin/repo.c | 1 -\n 1 file changed, 1 deletion(-)\n\ndiff --git a/builtin/repo.c b/builtin/repo.c\nindex 0ea045abc1..5540bd25d2 100644\n--- a/builtin/repo.c\n+++ b/builtin/repo.c\n@@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)\n \t\tconst char *unit = \"\";\n \n \t\tif (entry) {\n-\t\t\tstruct stats_table_entry *entry = item->util;\n \t\t\tvalue = entry->value;\n \t\t\tif (entry->unit)\n \t\t\t\tunit = entry->unit;\n-- \ngitgitgadget\n"},{"id":"538349","messageId":"xmqqcy1cz8hw.fsf@gitster.g","threadId":"65187","inReplyTo":"pull.2062.git.1773109018.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/2] repo: remove redundant variable shadow in stats_table_print_structure","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-03-10T03:08:43Z","receivedAt":"2026-03-10T03:08:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Mansi Singh via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> The variable i is declared in the outer scope of\n> stats_table_print_structure() and then re-declared inside the loop,\n> shadowing the outer one unnecessarily. Remove the redundant inner\n> declaration to clean up the scope.\n>\n> Signed-off-by: Mansi Singh mansimaanu8627@gmail.com\n\nThe above sounds more like a description for a single patch, not a\ncover letter.\n\nBecause we strongly encourage one patch doing only one thing and\ndoing it well, a commit log message for one of the patches in a\ntwo-patch series rarely makes a good description for the whole\nseries.\n\nBut reading it again, which variable 'i' is it talking about?  [2/2]\ndoes address 'entry' that is declared in an inner scope, masking the\nvariable with the same name declared in an outer scope.\n\nStepping back a bit, I do not quite see the need for these two\npatcches to form a single topic.  They look pretty much totally\nindependent topics.  Perhaps you're better off treating them as two\nindependent topics, each with a single patch.\n\n> Mansi (1):\n>   t7605: use test_path_is_file instead of test -f\n>\n> Mansi Singh (1):\n>   repo: remove redundant variable shadow in stats_table_print_structure\n\nAre these two patches from two different people?\n\nLast time in https://lore.kernel.org/git/xmqqv7fjw6yx.fsf@gitster.g/\nwe had three names, and we now have only two, so that can be called\nan improvement, but let's whittle them down to just one ;-).\n\nThanks.\n"},{"id":"538416","messageId":"20260310130819.41516-1-jayatheerthkulkarni2005@gmail.com","threadId":"65187","inReplyTo":"4adf6d4dca90e2c7f780d594a533c21247c459b8.1773109018.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/2] repo: remove redundant variable shadow in stats_table_print_structure","fromName":"K Jayatheerth","fromEmail":"jayatheerthkulkarni2005@gmail.com","sentAt":"2026-03-10T13:08:19Z","receivedAt":"2026-03-10T13:08:35Z","isPatch":true,"sender":{"key":"jayatheerthkulkarni2005@gmail.com","avatar":"https://avatars.githubusercontent.com/u/148841023?v=4"},"body":"\n> Remove the inner redeclaration since the outer 'entry' is already\n> available and non-NULL at that point.\n>\n> Signed-off-by: Mansi Singh <mansimaanu8627@gmail.com>\n> ---\n>  builtin/repo.c | 1 -\n>  1 file changed, 1 deletion(-)\n>\n> diff --git a/builtin/repo.c b/builtin/repo.c\n> index 0ea045abc1..5540bd25d2 100644\n> --- a/builtin/repo.c\n> +++ b/builtin/repo.c\n> @@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)\n>  \t\tconst char *unit = \"\";\n>\n>  \t\tif (entry) {\n> -\t\t\tstruct stats_table_entry *entry = item->util;\n>  \t\t\tvalue = entry->value;\n>  \t\t\tif (entry->unit)\n>  \t\t\t\tunit = entry->unit;\n> --\n> gitgitgadget\n\nHi Mansi,\n\nThis is a good catch\nbut I have to say this patch is already sent by me\nAnd is also merged into the master branch [1].\n\nYou can search in the mailing list or sometimes check the\n\"What's cooking in git.git\" (recent one [2]) before making the changes.\nYou don't need anyone's permission to work on a patch\nbut it is also important to not step on someone's toes ;)\n\n1 - https://github.com/git/git/commit/676c145afdd88024057296f11fdf2c224001549e\n2 - https://lore.kernel.org/git/xmqqh5qozdkq.fsf@gitster.g/T/#u\n\ncoming to the double naming problem\nThat is because one of your patch is using `format-patch` and `send-email` method of sending patches\nand the other one is using `gitgitgadget`.\n\nMy suggestion would be to stick with one and move forward with that for the entirety.\n\nRegards,\n- Jayatheerth\n"}]}