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

2 messages from 2014-06-11 to 2014-06-11. Participants: Jacek Konieczny, Junio C Hamano.
Thread: https://gitlist.dev/t/36887

## Jacek Konieczny, 2014-06-11 08:47

Subject: [PATCH] pull: Do not abuse 'break' inside a shell 'case'
Message-ID: <1402476465-27177-1-git-send-email-jajcus@jajcus.net>
URL: https://gitlist.dev/e/1402476465-27177-1-git-send-email-jajcus%40jajcus.net

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

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, 2014-06-11 20:13

Subject: Re: [PATCH] pull: Do not abuse 'break' inside a shell 'case'
Message-ID: <xmqqvbs76w7p.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqvbs76w7p.fsf%40gitster.dls.corp.google.com
In-Reply-To: <1402476465-27177-1-git-send-email-jajcus@jajcus.net>

```
Jacek Konieczny <jajcus@jajcus.net> writes:

> 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.




>  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

```
