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

[PATCH 1/2] bash prompt: test untracked files status indicator with untracked dirs

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jul 19, 2015, 11:28 UTC
Message-ID
<1437305286-23587-1-git-send-email-szeder@ira.uka.de>

The next commit will tweak the way __git_ps1() decides whether to display the untracked files status indicator in the presence of untracked directories. Add tests to make sure it doesn't change current behavior, in particular that an empty untracked directory doesn't trigger the untracked files status indicator.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 t/t9903-bash-prompt.sh | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 49d58e6726..6b68777b98 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -397,6 +397,31 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
 	test_cmp expected "$actual"
 '
 
+test_expect_success 'prompt - untracked files status indicator - empty untracked dir' '
+	printf " (master)" >expected &&
+	mkdir otherrepo/untracked-dir &&
+	test_when_finished "rm -rf otherrepo/untracked-dir" &&
+	(
+		GIT_PS1_SHOWUNTRACKEDFILES=y &&
+		cd otherrepo &&
+		__git_ps1 >"$actual"
+	) &&
+	test_cmp expected "$actual"
+'
+
+test_expect_success 'prompt - untracked files status indicator - non-empty untracked dir' '
+	printf " (master %%)" >expected &&
+	mkdir otherrepo/untracked-dir &&
+	test_when_finished "rm -rf otherrepo/untracked-dir" &&
+	>otherrepo/untracked-dir/untracked-file &&
+	(
+		GIT_PS1_SHOWUNTRACKEDFILES=y &&
+		cd otherrepo &&
+		__git_ps1 >"$actual"
+	) &&
+	test_cmp expected "$actual"
+'
+
 test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '
 	printf " (master %%)" >expected &&
 	(
-- 
2.5.0.rc2.15.gd82f7f6
Next: SZEDER Gábor
Message 1 of 2 in “bash prompt: test untracked files status indicator with untracked dirs”
  1. 1/2 bash prompt: test untracked files status indicator with untracked dirsSZEDER Gábor, Jul 19, 2015
  2. 2/2 bash prompt: faster untracked status indicator with untracked directoriesSZEDER Gábor, Jul 19, 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.