git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Philip Jägenstedt" <philip@foolip.org>
Cc: git@vger.kernel.org, "SZEDER Gábor" <szeder@ira.uka.de>,
	"Felipe Contreras" <felipe.contreras@gmail.com>,
	"Teemu Likonen" <tlikonen@iki.fi>
Subject: Re: [PATCH 2/4] completion: normalize increment/decrement style
Date: Wed, 22 Feb 2012 14:05:17 -0800	[thread overview]
Message-ID: <7vvcmy8qxu.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1329901093-24106-3-git-send-email-philip@foolip.org> ("Philip Jägenstedt"'s message of "Wed, 22 Feb 2012 09:58:11 +0100")

Philip Jägenstedt <philip@foolip.org> writes:

> The style used for incrementing and decrementing variables was fairly
> inconsistenty and was normalized to use x++, or ((x++)) in contexts
> where the former would otherwise be interpreted as a command. This is a
> bash-ism, but for obvious reasons this script is already bash-specific.
>
> Signed-off-by: Philip Jägenstedt <philip@foolip.org>

I am not sure if the kind of changes seen in the following hunks are
necessary but I do not care too deeply about it.  Assuming that the
change does not make the emulation by zsh unhappy, will apply.

Please stop me if somebody has issues with this rewrite.

Thanks.

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index c63a408..1903bc9 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -178,10 +178,8 @@ __git_ps1_show_upstream ()
>  			for commit in $commits
>  			do
>  				case "$commit" in
> -				"<"*) let ++behind
> -					;;
> -				*)    let ++ahead
> -					;;
> +				"<"*) ((behind++)) ;;
> +				*)    ((ahead++))  ;;
>  				esac
>  			done
>  			count="$behind	$ahead"
> @@ -739,7 +737,7 @@ __git_complete_remote_or_refspec ()
>  	local cur_="$cur" cmd="${words[1]}"
>  	local i c=2 remote="" pfx="" lhs=1 no_complete_refspec=0
>  	if [ "$cmd" = "remote" ]; then
> -		c=$((++c))
> +		((c++))
>  	fi
>  	while [ $c -lt $cword ]; do
>  		i="${words[c]}"

  reply	other threads:[~2012-02-22 22:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-18 13:32 [PATCH] completion: remote set-* <name> and <branch> Philip Jägenstedt
2012-02-20  7:58 ` Junio C Hamano
2012-02-21 21:29   ` Philip Jägenstedt
2012-02-21 21:54     ` [PATCH v2] " Philip Jägenstedt
2012-02-22  0:17       ` SZEDER Gábor
2012-02-22  8:58         ` [PATCH v3] " Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 1/4] " Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 2/4] completion: normalize increment/decrement style Philip Jägenstedt
2012-02-22 22:05             ` Junio C Hamano [this message]
2012-02-22  8:58           ` [PATCH 3/4] completion: remove stale "to submit patches" documentation Philip Jägenstedt
2012-02-22  8:58           ` [PATCH 4/4] completion: use tabs for indentation Philip Jägenstedt
2012-02-22  9:52           ` [PATCH v3] completion: remote set-* <name> and <branch> Thomas Rast
2012-02-21 22:23     ` [PATCH] " Junio C Hamano
2012-02-22  0:03       ` SZEDER Gábor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vvcmy8qxu.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=philip@foolip.org \
    --cc=szeder@ira.uka.de \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).