From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29871 invoked by alias); 4 Apr 2014 10:15:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32526 Received: (qmail 1942 invoked from network); 4 Apr 2014 10:15:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 From: Frank Terbeck To: Daniel Shahaf Cc: zsh-workers@zsh.org Subject: Re: [PATCH] vcs_info: git: Support stagedstr(%c) without unstagedstr(%u) In-Reply-To: <20140329094949.GB11569@tarsus.local2> (Daniel Shahaf's message of "Sat, 29 Mar 2014 09:49:49 +0000") References: <20140329094949.GB11569@tarsus.local2> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) Date: Fri, 04 Apr 2014 11:53:11 +0200 Message-ID: <87fvlte7zs.fsf@ft.bewatermyfriend.org> MIME-Version: 1.0 Content-Type: text/plain X-Df-Sender: NDMwNDQ0 Daniel Shahaf wrote: > Hello. Hi! Sorry for the delay. > I'd like to have my prompt alert me when I have staged changes (because it's a > pain to keep running 'git diff --staged' before every 'git commit -a'). > However, I don't want to enable detection of unstaged changes too as that's > more expensive (disk crawl v. metadata crawl). Yes, makes sense. [...] > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr [...] > + # TODO: document in zshcontrib that bzr supports check-for-changes > + # (also in VCS_INFO_bzr_get_info_restricted) Sounds like a plan. Do you want the job? :) [...] > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git [...] > +local querystaged queryunstaged If you'd make this "local -i ..." the variables would be integers, defaulting to zero. Then you could do... [...] > +if [[ -n $querystaged || -n $queryunstaged ]] && \ +if (( querystaged || queryunstaged )) && \ [...] > + if [[ -n $queryunstaged ]] ; then + if (( queryunstaged )); then [...] > + if [[ -n $querystaged ]] ; then + if (( querystaged )); then Which is a little more pleasing to my eyes at least. The rest looks good. Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925