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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Quoting Junio C Hamano <gitster@xxxxxxxxx>:

> Cody A Taylor <cody.taylor@xxxxxxxxxxxxxxxxxxxxxxxxx> 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 &&
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]