git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] remove unnecessary if statement
@ 2025-04-20  2:54 Usman Akinyemi
  2025-04-20  2:54 ` [PATCH 1/2] builtin/add: " Usman Akinyemi
  2025-04-20  2:54 ` [PATCH 2/2] builtin/difftool: " Usman Akinyemi
  0 siblings, 2 replies; 3+ messages in thread
From: Usman Akinyemi @ 2025-04-20  2:54 UTC (permalink / raw)
  To: git, christian.couder
  Cc: gitster, johncai86, me, ps, shejialuo, phillip.wood123

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 <ps@pks.im>

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(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] builtin/add: remove unnecessary if statement
  2025-04-20  2:54 [PATCH 0/2] remove unnecessary if statement Usman Akinyemi
@ 2025-04-20  2:54 ` Usman Akinyemi
  2025-04-20  2:54 ` [PATCH 2/2] builtin/difftool: " Usman Akinyemi
  1 sibling, 0 replies; 3+ messages in thread
From: Usman Akinyemi @ 2025-04-20  2:54 UTC (permalink / raw)
  To: git, christian.couder
  Cc: gitster, johncai86, me, ps, shejialuo, phillip.wood123,
	Christian Couder

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()`.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 builtin/add.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 78dfb26577..747511b68b 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -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);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] builtin/difftool: remove unnecessary if statement
  2025-04-20  2:54 [PATCH 0/2] remove unnecessary if statement Usman Akinyemi
  2025-04-20  2:54 ` [PATCH 1/2] builtin/add: " Usman Akinyemi
@ 2025-04-20  2:54 ` Usman Akinyemi
  1 sibling, 0 replies; 3+ messages in thread
From: Usman Akinyemi @ 2025-04-20  2:54 UTC (permalink / raw)
  To: git, christian.couder
  Cc: gitster, johncai86, me, ps, shejialuo, phillip.wood123,
	Christian Couder

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()`.

Suggested-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
---
 builtin/difftool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/builtin/difftool.c b/builtin/difftool.c
index 41cd00066c..c7348a1dca 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -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,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-20  2:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-20  2:54 [PATCH 0/2] remove unnecessary if statement Usman Akinyemi
2025-04-20  2:54 ` [PATCH 1/2] builtin/add: " Usman Akinyemi
2025-04-20  2:54 ` [PATCH 2/2] builtin/difftool: " Usman Akinyemi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).