Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: SZEDER Gábor <hidden>
Date: 2016-06-15 23:04:09
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Hi,

Quoting Junio C Hamano [off-list ref]:
Cody A Taylor [off-list ref] writes:
quoted
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 &&
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help