Re: [PATCH v5 02/17] sparse-checkout: create 'init' subcommand
From: SZEDER Gábor <hidden>
Date: 2019-11-20 14:14:03
From: SZEDER Gábor <hidden>
Date: 2019-11-20 14:14:03
On Tue, Nov 19, 2019 at 03:33:08PM +0100, SZEDER Gábor wrote:
quoted
+ argv_array_pushl(&argv, "config", "--worktree", "core.sparseCheckout", NULL); + + if (mode) + argv_array_pushl(&argv, "true", NULL); + else + argv_array_pushl(&argv, "false", NULL); + + if (run_command_v_opt(argv.argv, RUN_GIT_CMD)) { + error(_("failed to enable core.sparseCheckout")); + return 1; + }Why the external 'git config' invocation? git_config_set_in_file_gently(git_path("config.worktree"), "core.sparseCheckout", mode ? "true" : "false")
Having slept on it, I think it would be even better to pass NULL instead of "false". "false", well, just sets the configuration variable to false, but a NULL would properly unset it.