threads / patch / 17616

patch, 2 partscompletion: Fixes GIT_PS1_SHOWDIRTYSTATE problems

Subject: [PATCH 0/2] completion: Fixes GIT_PS1_SHOWDIRTYSTATE problems

## tl;dr

9 messages between Feb 6, 2009 and Feb 6, 2009. Diffs are folded; open one to read it.

replies: 8people: 3as markdown or json

Ted Pavlic· Feb 6, 2009, 15:46 UTC · lore

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(-)
Ted Pavlic· Feb 6, 2009, 15:46 UTC · re: Ted Pavlic · lore

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

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to contrib/completion/git-completion.bash +1 −1
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 307bf5d..6e04985 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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="*"
-- 
1.6.1.2.319.gbd9e
Ted Pavlic· Feb 6, 2009, 15:46 UTC · re: Ted Pavlic · lore

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

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 contrib/completion/git-completion.bash |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Show changes to contrib/completion/git-completion.bash +5 −5
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6e04985..f44f63c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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:
 #
-- 
1.6.1.2.319.gbd9e
Shawn O. Pearce· Feb 6, 2009, 15:58 UTC · re: Ted Pavlic · lore

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

Ted Pavlic <ted@tedpavlic.com> wrote:
> Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Both patches,
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
Show 28 quoted lines
> ---
>  contrib/completion/git-completion.bash |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6e04985..f44f63c 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -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:
>  #
> -- 
> 1.6.1.2.319.gbd9e
> 
-- 
Shawn.
Ted Pavlic· Feb 6, 2009, 16:05 UTC · re: Shawn O. Pearce · lore

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

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to contrib/completion/git-completion.bash +1 −1
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 307bf5d..6e04985 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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="*"
-- 
1.6.1.2.390.gba743
Ted Pavlic· Feb 6, 2009, 16:05 UTC · re: Ted Pavlic · lore

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

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Show changes to contrib/completion/git-completion.bash +5 −5
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6e04985..f44f63c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -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:
 #
-- 
1.6.1.2.390.gba743
Shawn O. Pearce· Feb 6, 2009, 16:13 UTC · re: Ted Pavlic · lore

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

Ted Pavlic <ted@tedpavlic.com> wrote:
> Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>
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.

-- 
Shawn.
Ted Pavlic· Feb 6, 2009, 16:19 UTC · re: Shawn O. Pearce · lore

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

> 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.

> 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

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.
Thomas Rast· Feb 6, 2009, 23:32 UTC · re: Shawn O. Pearce · lore

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

Shawn O. Pearce wrote:
> 
> 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 ;-)
-- 
Thomas Rast
trast@{inf,student}.ethz.ch

← back to recent threads