threads / patch / 36468

patchgit.c: treat RUN_SETUP_GENTLY and RUN_SETUP as mutually exclusive

Subject: [PATCH] git.c: treat RUN_SETUP_GENTLY and RUN_SETUP as mutually exclusive

## tl;dr

2 messages between Apr 22, 2014 and Apr 22, 2014. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Luis R. Rodriguez· Apr 22, 2014, 00:47 UTC · lore
From: "Luis R. Rodriguez" <mcgrof@suse.com>
This saves us a few branches when RUN_SETUP is set up.
Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
---
 git.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to git.c +1 −1
diff --git a/git.c b/git.c
index 9efd1a3..7780572 100644
--- a/git.c
+++ b/git.c
@@ -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);
 		}
-- 
1.9.0
Junio C Hamano· Apr 22, 2014, 19:37 UTC · re: Luis R. Rodriguez · lore

Re: [PATCH] git.c: treat RUN_SETUP_GENTLY and RUN_SETUP as mutually exclusive

"Luis R. Rodriguez" <mcgrof@do-not-panic.com> writes:
Show 6 quoted lines
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> This saves us a few branches when RUN_SETUP is set up.
>
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---

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

Show 16 quoted lines
>  git.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git.c b/git.c
> index 9efd1a3..7780572 100644
> --- a/git.c
> +++ b/git.c
> @@ -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);
>  		}

← back to recent threads