From: SZEDER Gábor Date: Sun, 15 Mar 2015 11:49:04 GMT Subject: Re: [PATCH v2] git prompt: Use toplevel to find untracked files. Message-ID: <1426420144-10584-1-git-send-email-szeder@ira.uka.de> In-Reply-To: Hi, Quoting Junio C Hamano : > Cody A Taylor 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? > 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 &&