remove unnecessary if statement
cover remove unnecessary if statement
Since we already teach the repo_config() in "f29f1990b5 (config: teach repo_config to allow repo to be NULL, 2025-03-08)" to allow repo to be NULL, no need to check if repo is NULL before calling repo_config().
This was suggested by Patrick Steinhardt <[email protected]>
Usman Akinyemi (2):
builtin/add: remove unnecessary if statement builtin/difftool: remove unnecessary if statement
builtin/add.c | 3 +-- builtin/difftool.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/2 builtin/add: remove unnecessary if statement
Since we already teach the repo_config() in "f29f1990b5 (config: teach repo_config to allow repo to be NULL, 2025-03-08)" to allow repo to be NULL, no need to check if repo is NULL before calling repo_config().
--- builtin/add.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
builtin/add.c +1 -2
@@ -386,8 +386,7 @@ int cmd_add(int argc,char *ps_matched =NULL ;struct lock_file lock_file =LOCK_INIT ; -if (repo) -repo_config (repo, add_config,NULL ); +repo_config (repo, add_config,NULL ); argc =parse_options (argc, argv, prefix, builtin_add_options, builtin_add_usage,PARSE_OPT_KEEP_ARGV0 );
Signature · 1 line
2.49.0
PATCH 2/2 builtin/difftool: remove unnecessary if statement
In reply to Usman AkinyemiSince we already teach the repo_config() in "f29f1990b5 (config: teach repo_config to allow repo to be NULL, 2025-03-08)" to allow repo to be NULL, no need to check if repo is NULL before calling repo_config().
--- builtin/difftool.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
builtin/difftool.c +1 -2
@@ -750,8 +750,7 @@ int cmd_difftool(int argc, };struct child_process child =CHILD_PROCESS_INIT ; -if (repo) -repo_config (repo, difftool_config, &dt_options); +repo_config (repo, difftool_config, &dt_options); dt_options.symlinks = dt_options.has_symlinks; argc = parse_options(argc, argv, prefix, builtin_difftool_options,
Signature · 1 line
2.49.0