git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Mar 15, 2015, 11:49 UTC
Message-ID
<1426420144-10584-1-git-send-email-szeder@ira.uka.de>
In-Reply-To
<xmqqmw3hzakn.fsf@gitster.dls.corp.google.com>
Hi,
Quoting Junio C Hamano <gitster@pobox.com>:
Show 6 quoted lines
> 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?

> 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 &&
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “git prompt: Use toplevel to find untracked files.”
  1. git prompt: Use toplevel to find untracked files.Cody A Taylor, Mar 13, 2015
  2. Junio C HamanoMar 13, 2015
  3. SZEDER GáborMar 15, 2015
  4. Junio C HamanoMar 15, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.