Skip to contentSkip to conversation

git.c: treat RUN_SETUP_GENTLY and RUN_SETUP as mutually exclusive

PATCH In review Luis R. Rodriguez 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git.c: treat RUN_SETUP_GENTLY and RUN_SETUP as mutually exclusive

From: "Luis R. Rodriguez" <[email protected]>

This saves us a few branches when RUN_SETUP is set up.

---
 git.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git.c +1 -1
index 9efd1a3..7780572 100644
@@ -290,7 +290,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 	if (!help) {
 		if (p->option & RUN_SETUP)
 			prefix = setup_git_directory();
-		if (p->option & RUN_SETUP_GENTLY) {
+		else if (p->option & RUN_SETUP_GENTLY) {
 			int nongit_ok;
 			prefix = setup_git_directory_gently(&nongit_ok);
 		}
Signature · 1 line
1.9.0
#1 lore raw
Quoted 6 lines · Luis R. Rodriguez

From: "Luis R. Rodriguez" <[email protected]>

This saves us a few branches when RUN_SETUP is set up.

---

Makes sense, especially because there is no sane reason to set both bits on.

Quoted 16 lines
 git.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
git.c +1 -1
index 9efd1a3..7780572 100644
@@ -290,7 +290,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 	if (!help) {
 		if (p->option & RUN_SETUP)
 			prefix = setup_git_directory();
-		if (p->option & RUN_SETUP_GENTLY) {
+		else if (p->option & RUN_SETUP_GENTLY) {
 			int nongit_ok;
 			prefix = setup_git_directory_gently(&nongit_ok);
 		}