Re: [PATCH v3 2/3] submodule--helper: teach config subcommand --unset
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 7, 2019, 22:29 UTC
- Message-ID
- <xmqqpns3mdvh.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <e90dfe992e96b33f167d08fe51df49ab1d10ef23.1549534460.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
Show 6 quoted lines
> + if (argc == 3 || (argc == 2 && command == DO_UNSET)) {
> if (!is_writing_gitmodules_ok())
> die(_("please make sure that the .gitmodules file is in the working tree"));
>
> - return config_set_in_gitmodules_file_gently(argv[1], argv[2]);
> + const char *value = (argc == 3) ? argv[2] : NULL;This introduces decl-after-stmt. Move it before the "is it OK to write?" check.
> + return config_set_in_gitmodules_file_gently(argv[1], value); > }