Re: [PATCH v2] git prompt: Use toplevel to find untracked files.
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 15 quoted lines
> Hi,
>
> Quoting Junio C Hamano <gitster@pobox.com>:
>
>> Cody A Taylor <cody.taylor@maternityneighborhood.com> 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.
Show 29 quoted lines
>
>> 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 &&