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

Re: [PATCH v2 2/3] t9903: add tests for bash.showUntrackedFiles

flat view

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:09

Martin Erik Werner [off-list ref] writes:
quoted hunk
Add 4 test for the bash.showUntrackedFiles config option, covering all
combinations of the shell var being set/unset and the config option
being enabled/disabled.

Signed-off-by: Martin Erik Werner <redacted>
---
 t/t9903-bash-prompt.sh |   40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index f17c1f8..cb008e2 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -437,6 +437,46 @@ test_expect_success 'prompt - untracked files status indicator - untracked files
 	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 &&
+	(
+		unset -v GIT_PS1_SHOWUNTRACKEDFILES &&
We do not use "unset -v" anywhere else in our system.  Shells
mimicking SysV may choke on it.  A Portable POSIX script can omit
"-v" when unsetting a variable.

Also "unset" can return false when the variable is not set to begin
with with some shells.

Neither of these matters for this particular case because we know we
are running this under bash in non-posix mode.  I however wonder if
we can do something to prevent careless coders to copy and paste
this piece when updating other tests that are not limited to bash.
Commenting each and every use of "unset -v" does not sound like a
good solution and perhaps I am being unnecessarily worried too much.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help