threads / patch / 36887

patchpull: Do not abuse 'break' inside a shell 'case'

Subject: [PATCH] pull: Do not abuse 'break' inside a shell 'case'

## tl;dr

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

replies: 1people: 2as markdown or json

Jacek Konieczny· Jun 11, 2014, 08:47 UTC · lore
It is not C. The code would break under mksh when 'pull.ff' is set:
  $ git pull
  /usr/lib/git-core/git-pull[67]: break: can't break
  Already up-to-date.
Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
---
 git-pull.sh | 2 --
 1 file changed, 2 deletions(-)
Show changes to git-pull.sh +0 −2
diff --git a/git-pull.sh b/git-pull.sh
index 6cd8ebc..7358fac 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -58,11 +58,9 @@ pull_ff=$(git config pull.ff)
 case "$pull_ff" in
 false)
 	no_ff=--no-ff
-	break
 	;;
 only)
 	ff_only=--ff-only
-	break
 	;;
 esac
 
-- 
2.0.0
Junio C Hamano· Jun 11, 2014, 20:13 UTC · re: Jacek Konieczny · lore

Re: [PATCH] pull: Do not abuse 'break' inside a shell 'case'

Jacek Konieczny <jajcus@jajcus.net> writes:
Show 8 quoted lines
> It is not C. The code would break under mksh when 'pull.ff' is set:
>
>   $ git pull
>   /usr/lib/git-core/git-pull[67]: break: can't break
>   Already up-to-date.
>
> Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
> ---

Thanks for spotting; I cannot believe this somehow got through unnoticed.

As this fixes b814da89 (pull: add pull.ff configuration, 2014-01-15), it will eventually have to go to both master for 2.1 and maint for 2.0.1.

Show 18 quoted lines
>  git-pull.sh | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/git-pull.sh b/git-pull.sh
> index 6cd8ebc..7358fac 100755
> --- a/git-pull.sh
> +++ b/git-pull.sh
> @@ -58,11 +58,9 @@ pull_ff=$(git config pull.ff)
>  case "$pull_ff" in
>  false)
>  	no_ff=--no-ff
> -	break
>  	;;
>  only)
>  	ff_only=--ff-only
> -	break
>  	;;
>  esac

← back to recent threads