Skip to contentSkip to conversation

completion: Fixes GIT_PS1_SHOWDIRTYSTATE problems

PATCH In review Ted Pavlic 3 participants 9 messages Jun 15, 2016

lore
Share & tools
lore

Ted Pavlic

author
#0 lore raw

cover completion: Fixes GIT_PS1_SHOWDIRTYSTATE problems

These two patches correct some problems introduced by the recent GIT_PS1_SHOWDIRTYSTATE fixes.

The first changes $VAR to ${VAR-} to
prevent the unbound variable errors that were discussed earlier on the list.

The second changes the GIT_PS1_SHOWDIRTYSTATE documentation from

#(Tab)Text

to

#(7 spaces)Text

to be consistent with the surrounding text.

Ted Pavlic (2):
completion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable
errors.
completion: Get rid of tabbed indentation in comments. Replace with
spaces.

 contrib/completion/git-completion.bash |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
author
#1 lore raw

PATCH 1/2 completion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable errors.

---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/completion/git-completion.bash +1 -1
index 307bf5d..6e04985 100755
@@ -125,7 +125,7 @@ __git_ps1 ()
 		local w
 		local i
 
-		if test -n "$GIT_PS1_SHOWDIRTYSTATE"; then
+		if test -n "${GIT_PS1_SHOWDIRTYSTATE-}"; then
 			if test "$(git config --bool bash.showDirtyState)" != "false"; then
 				git diff --no-ext-diff --ignore-submodules \
 					--quiet --exit-code || w="*"
Signature · 1 line
1.6.1.2.319.gbd9e
author
#2 lore raw

PATCH 2/2 completion: Get rid of tabbed indentation in comments. Replace with spaces.

---
 contrib/completion/git-completion.bash |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
contrib/completion/git-completion.bash +5 -5
index 6e04985..f44f63c 100755
@@ -34,11 +34,11 @@
 #       are currently in a git repository.  The %s token will be
 #       the name of the current branch.
 #
-#	In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
-#	value, unstaged (*) and staged (+) changes will be shown next
-#	to the branch name.  You can configure this per-repository
-#	with the bash.showDirtyState variable, which defaults to true
-#	once GIT_PS1_SHOWDIRTYSTATE is enabled.
+#       In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
+#       value, unstaged (*) and staged (+) changes will be shown next
+#       to the branch name.  You can configure this per-repository
+#       with the bash.showDirtyState variable, which defaults to true
+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.
 #
 # To submit patches:
 #
Signature · 1 line
1.6.1.2.319.gbd9e
#3 lore raw

Re: [PATCH 2/2] completion: Get rid of tabbed indentation in comments. Replace with spaces.

Quoted 1 line · Ted Pavlic

Both patches,

Quoted 28 lines
---
 contrib/completion/git-completion.bash |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
contrib/completion/git-completion.bash +5 -5
index 6e04985..f44f63c 100755
@@ -34,11 +34,11 @@
 #       are currently in a git repository.  The %s token will be
 #       the name of the current branch.
 #
-#	In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
-#	value, unstaged (*) and staged (+) changes will be shown next
-#	to the branch name.  You can configure this per-repository
-#	with the bash.showDirtyState variable, which defaults to true
-#	once GIT_PS1_SHOWDIRTYSTATE is enabled.
+#       In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
+#       value, unstaged (*) and staged (+) changes will be shown next
+#       to the branch name.  You can configure this per-repository
+#       with the bash.showDirtyState variable, which defaults to true
+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.
 #
 # To submit patches:
 #
Signature · 1 line
1.6.1.2.319.gbd9e
Signature · 1 line
Shawn.
author
#4 lore raw

PATCH 1/2 completion: Fix GIT_PS1_SHOWDIRTYSTATE to prevent unbound variable errors.

---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/completion/git-completion.bash +1 -1
index 307bf5d..6e04985 100755
@@ -125,7 +125,7 @@ __git_ps1 ()
 		local w
 		local i
 
-		if test -n "$GIT_PS1_SHOWDIRTYSTATE"; then
+		if test -n "${GIT_PS1_SHOWDIRTYSTATE-}"; then
 			if test "$(git config --bool bash.showDirtyState)" != "false"; then
 				git diff --no-ext-diff --ignore-submodules \
 					--quiet --exit-code || w="*"
Signature · 1 line
1.6.1.2.390.gba743
author
#5 lore raw

PATCH 2/2 completion: Get rid of tabbed indentation in comments. Replace with spaces.

---
 contrib/completion/git-completion.bash |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
contrib/completion/git-completion.bash +5 -5
index 6e04985..f44f63c 100755
@@ -34,11 +34,11 @@
 #       are currently in a git repository.  The %s token will be
 #       the name of the current branch.
 #
-#	In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
-#	value, unstaged (*) and staged (+) changes will be shown next
-#	to the branch name.  You can configure this per-repository
-#	with the bash.showDirtyState variable, which defaults to true
-#	once GIT_PS1_SHOWDIRTYSTATE is enabled.
+#       In addition, if you set GIT_PS1_SHOWDIRTYSTATE to a nonempty
+#       value, unstaged (*) and staged (+) changes will be shown next
+#       to the branch name.  You can configure this per-repository
+#       with the bash.showDirtyState variable, which defaults to true
+#       once GIT_PS1_SHOWDIRTYSTATE is enabled.
 #
 # To submit patches:
 #
Signature · 1 line
1.6.1.2.390.gba743
#6 lore raw

Re: [PATCH 2/2] completion: Get rid of tabbed indentation in comments. Replace with spaces.

Quoted 2 lines · Ted Pavlic

Heh.

I expected Junio to use my TAB line as-is. I find them amusing. Plus, I didn't actually apply your patches and test them. They just looked right to me. Usually Acked-by is applied only if you actually ran the code and verified it does what the message claims. Trivially-acked-by is a bit less strict.

Whatever. These are really trivial patches. Whatever Junio applies here is fine.

Thanks for fixing that ${X-} thing. I clearly missed it on the review of the ps1 stuff.

Signature · 1 line
Shawn.
#7 lore raw

Re: [PATCH 2/2] completion: Get rid of tabbed indentation in comments. Replace with spaces.

Quoted 3 lines · Shawn O. Pearce

Thanks for fixing that ${X-} thing. I clearly missed it on the review of the ps1 stuff.

Sorry for not thinking of that, I actually remember the thread around the original ${X-} cleanup...

For extra sillyness you could also add my Ack ;-)

Signature · 2 lines
Thomas Rast
trast@{inf,student}.ethz.ch
author
#8 lore raw

Re: [PATCH 2/2] completion: Get rid of tabbed indentation in comments. Replace with spaces.

In reply to Shawn O. Pearce
Quoted 1 line

I expected Junio to use my TAB line as-is. I find them amusing.

Oops. :( In the future, I'll leave such things as is. I just figured the "Trivially" was a side comment, but the function was still the same.

Quoted 2 lines

Thanks for fixing that ${X-} thing. I clearly missed it on the review of the ps1 stuff.

I would have missed it myself... but then after I did a git pull, I was getting a bash error on every single prompt. That was annoying. :)

Thanks --
Ted

Signature · 5 lines
Ted Pavlic <[email protected]>

  Please visit my ALS association page:
        http://web.alsa.org/goto/tedpavlic
  My family appreciates your support in the fight to defeat ALS.