Subject: Re: [PATCH 02/19] tests: add tests for the bash prompt functions in the completion script

From: SZEDER Gábor <[email-masked]>
Date: Wed, 9 May 2012 22:33:54 +0200

On Wed, May 09, 2012 at 11:36:25AM -0700, Junio C Hamano wrote:
> SZEDER Gábor <[email-masked]> writes:
> 
> > The tests cover the discovery of the '.git' directory in the __gitdir()
> > function in different scenarios, and the prompt itself, i.e. branch
> > name, detached heads, operations (rebase, merge, cherry-pick, bisect),
> > and status indicators (dirty, stash, untracked files; but not the
> > upstream status).
> >
> > Signed-off-by: SZEDER Gábor <[email-masked]>
> 
> Looks like a quite comprehensive tests around GIT_PS1_$MANY_DIFFERENT_STYLES
> (except that GIT_PS1_SHOWUPSTREAM seems to be missing); very nice.

I've mentioned in the commit message that "... status indicators ...
but not the upstream status".  I didn't wrote tests for that because
this series doesn't changes anything in the function producing the
upstream status indicator.

However, thinking about it now, this series, in particular patch 16
(bash prompt: display stash and upstream state even inside the
repository), does change the context in which that function might be
invoked, i.e. not only from the work tree but even from within the
repository.  I don't think that would break anything (famous last
words ;), because that function runs git config, rev-list, and log,
and AFAICT these commands should work in a repository just as well,
and the rest of the function is just preparing their arguments and
processing their output.

Anyway, it would be definitely better to have a test to show that it
indeed works from within a repository, but I didn't want to fiddle
with svn upstreams.  Perhaps patch 16 should leave the upstream status
indicator as it is until someone ;) writes tests for it; since that
function doesn't affect the main codepath and it involves several
subshells and git processes anyway, there is not that much to be
gained anyway.

> > +	echo 1 > file &&
> 
> When you are going to re-roll to add the missing SHOWUPSTREAM test, in
> addition to J6t's $PWD vs $(pwd) vs $TRASH_DIRECTORY fix, please fix these
> redirections to match the coding styles (i.e. "cmd >file" and "cmd <file",
> with SP before and without SP after redirection operators).

OK.

I just followed suit of the recently added t9902-completion.sh, which
uses SP on both sides of redirection operators.