Subject: Re: [PATCH v2] git prompt: Use toplevel to find untracked files.

From: Junio C Hamano <[email-masked]>
Date: Sun, 15 Mar 2015 14:18:50 -0700

SZEDER Gábor <[email-masked]> writes:

> Hi,
>
> Quoting Junio C Hamano <[email-masked]>:
>
>> Cody A Taylor <[email-masked]> writes:
>>> The __git_ps1() prompt function would not show an untracked
>>> state when the current working directory was not a parent of
>>> the untracked file.
>>
>> Good find, and nicely explained.
>
> Somehow I had a hard time making sense out of "when the current working
> directory was not a parent of the untracked file".  Perhaps "when the
> untracked files are outside of the current working directory" would be
> easier to grok?

Sounds good; let me use that when squashing your test updates in.

Thanks, both.

>
>> I wonder if we can add a test
>> or two to t9903-bash-prompt.sh?
>
> This test fails without the patch in question and succeeds with it.
>
> -- 8< --
>
> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 51ecd3e..3d1a95f 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -397,6 +397,16 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
>  	test_cmp expected "$actual"
>  '
>  
> +test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
> +	printf " (master %%)" >expected &&
> +	(
> +		cd ignored_dir &&
> +		GIT_PS1_SHOWUNTRACKEDFILES=y &&
> +		__git_ps1 >"$actual"
> +	) &&
> +	test_cmp expected "$actual"
> +'
> +
>  test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
>  	printf " (master)" >expected &&
>  	test_config bash.showUntrackedFiles false &&