repo: remove redundant variable shadow in stats_table_print_structure#2062
Closed
MansiSingh17 wants to merge 0 commit intogitgitgadget:masterfrom
Closed
repo: remove redundant variable shadow in stats_table_print_structure#2062MansiSingh17 wants to merge 0 commit intogitgitgadget:masterfrom
MansiSingh17 wants to merge 0 commit intogitgitgadget:masterfrom
Conversation
Member
|
/allow |
|
User MansiSingh17 already allowed to use GitGitGadget. |
Author
|
/submit |
|
Error: Ignoring PR with empty title and/or body |
Author
|
/submit |
|
Submitted as pull.2062.git.1773109018.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
4adf6d4 to
ce74e19
Compare
ce74e19 to
d181b93
Compare
|
Junio C Hamano wrote on the Git mailing list (how to reply to this email): "Mansi Singh via GitGitGadget" <gitgitgadget@gmail.com> writes:
> The variable i is declared in the outer scope of
> stats_table_print_structure() and then re-declared inside the loop,
> shadowing the outer one unnecessarily. Remove the redundant inner
> declaration to clean up the scope.
>
> Signed-off-by: Mansi Singh mansimaanu8627@gmail.com
The above sounds more like a description for a single patch, not a
cover letter.
Because we strongly encourage one patch doing only one thing and
doing it well, a commit log message for one of the patches in a
two-patch series rarely makes a good description for the whole
series.
But reading it again, which variable 'i' is it talking about? [2/2]
does address 'entry' that is declared in an inner scope, masking the
variable with the same name declared in an outer scope.
Stepping back a bit, I do not quite see the need for these two
patcches to form a single topic. They look pretty much totally
independent topics. Perhaps you're better off treating them as two
independent topics, each with a single patch.
> Mansi (1):
> t7605: use test_path_is_file instead of test -f
>
> Mansi Singh (1):
> repo: remove redundant variable shadow in stats_table_print_structure
Are these two patches from two different people?
Last time in https://lore.kernel.org/git/xmqqv7fjw6yx.fsf@gitster.g/
we had three names, and we now have only two, so that can be called
an improvement, but let's whittle them down to just one ;-).
Thanks. |
|
K Jayatheerth wrote on the Git mailing list (how to reply to this email) regarding 4adf6d4 (outdated): > Remove the inner redeclaration since the outer 'entry' is already
> available and non-NULL at that point.
>
> Signed-off-by: Mansi Singh <mansimaanu8627@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;
> value = entry->value;
> if (entry->unit)
> unit = entry->unit;
> --
> gitgitgadget
Hi Mansi,
This is a good catch
but I have to say this patch is already sent by me
And is also merged into the master branch [1].
You can search in the mailing list or sometimes check the
"What's cooking in git.git" (recent one [2]) before making the changes.
You don't need anyone's permission to work on a patch
but it is also important to not step on someone's toes ;)
1 - https://github.com/git/git/commit/676c145afdd88024057296f11fdf2c224001549e
2 - https://lore.kernel.org/git/xmqqh5qozdkq.fsf@gitster.g/T/#u
coming to the double naming problem
That is because one of your patch is using `format-patch` and `send-email` method of sending patches
and the other one is using `gitgitgadget`.
My suggestion would be to stick with one and move forward with that for the entirety.
Regards,
- Jayatheerth |
|
User |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The variable
iis declared in the outer scope ofstats_table_print_structure() and then re-declared inside the loop,
shadowing the outer one unnecessarily. Remove the redundant inner
declaration to clean up the scope.
Signed-off-by: Mansi Singh mansimaanu8627@gmail.com
cc: K Jayatheerth jayatheerthkulkarni2005@gmail.com