Re: [PATCH 05/11] submodule.c: fix indentation
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2018, 17:34 UTC
- Message-ID
- <xmqqin3i1qes.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180904230149.180332-6-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
Show 19 quoted lines
> The submodule subsystem is really bad at staying within 80 characters.
> Fix it while we are here.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> submodule.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/submodule.c b/submodule.c
> index da2ed8696f5..8345d423fda 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1244,7 +1244,8 @@ static int get_next_submodule(struct child_process *cp,
> if (!submodule) {
> const char *name = default_name_or_path(ce->name);
> if (name) {
> - default_submodule.path = default_submodule.name = name;
> + default_submodule.path = name;
> + default_submodule.name = name;Besides indentation, it is good to avoid A = B = C assignment. Written this way, it is more obvious that these two fields share the same pointer.
Good.
Show 12 quoted lines
> submodule = &default_submodule; > } > } > @@ -1254,8 +1255,9 @@ static int get_next_submodule(struct child_process *cp, > default: > case RECURSE_SUBMODULES_DEFAULT: > case RECURSE_SUBMODULES_ON_DEMAND: > - if (!submodule || !unsorted_string_list_lookup(&changed_submodule_names, > - submodule->name)) > + if (!submodule || !unsorted_string_list_lookup( > + &changed_submodule_names, > + submodule->name))
if (!submodule || !unsorted_string_list_lookup( &changed_submodule_names, submodule->name))
would be easier to see what is going on.