contrib/completion/git-completion.bash: declare -g is not portable

4 messages, 4 authors, 2018-02-04 · open the first message on its own page

contrib/completion/git-completion.bash: declare -g is not portable

From: Torsten Bögershausen <hidden>
Date: 2018-02-03 17:20:32

Hej Duy,
After running t9902-completion.sh on Mac OS I got a failure
in this style:

.../projects/git/git.pu/t/../contrib/completion/git-completion.bash: line 300:
declare: -g: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]
--- expected	2018-02-03 17:10:18.000000000 +0000
+++ out	2018-02-03 17:10:18.000000000 +0000
@@ -1,15 +1,2 @@
---quiet
---detach
---track
---orphan=
---ours
---theirs
---merge
---conflict=
---patch
---ignore-skip-worktree-bits
---ignore-other-worktrees
---recurse-submodules
---progress
 --no-track
 --no-recurse-submodules
not ok 92 - double dash "git checkout"

What is "declare -g" good for ?

<https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#index-declare>

Re: contrib/completion/git-completion.bash: declare -g is not portable

From: Duy Nguyen <hidden>
Date: 2018-02-04 09:45:51

On Sun, Feb 4, 2018 at 12:20 AM, Torsten Bögershausen [off-list ref] wrote:
Hej Duy,
After running t9902-completion.sh on Mac OS I got a failure
in this style:
Sorry I was new with this bash thingy. Jeff already answered this (and
I will fix it in the re-roll) but just for my own information, what
bash version is shipped with Mac OS?
-- 
Duy

Re: contrib/completion/git-completion.bash: declare -g is not portable

From: Eric Sunshine <hidden>
Date: 2018-02-04 09:57:56

On Sun, Feb 4, 2018 at 4:45 AM, Duy Nguyen [off-list ref] wrote:
On Sun, Feb 4, 2018 at 12:20 AM, Torsten Bögershausen [off-list ref] wrote:
quoted
After running t9902-completion.sh on Mac OS I got a failure
in this style:
Sorry I was new with this bash thingy. Jeff already answered this (and
I will fix it in the re-roll) but just for my own information, what
bash version is shipped with Mac OS?
The MacOS bash is very old; note the copyright date:

    % /bin/bash --version
    GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
    Copyright (C) 2007 Free Software Foundation, Inc.

A recent bash installed manually (not from Apple):

    % /usr/local/bin/bash --version
    GNU bash, version 4.4.18(1)-release (x86_64-apple-darwin16.7.0)
    Copyright (C) 2016 Free Software Foundation, Inc.

Re: contrib/completion/git-completion.bash: declare -g is not portable

From: Lucas Werkmeister <hidden>
Date: 2018-02-04 11:48:54

On 04.02.2018 10:57, Eric Sunshine wrote:
On Sun, Feb 4, 2018 at 4:45 AM, Duy Nguyen [off-list ref] wrote:
quoted
On Sun, Feb 4, 2018 at 12:20 AM, Torsten Bögershausen [off-list ref] wrote:
quoted
After running t9902-completion.sh on Mac OS I got a failure
in this style:
Sorry I was new with this bash thingy. Jeff already answered this (and
I will fix it in the re-roll) but just for my own information, what
bash version is shipped with Mac OS?
The MacOS bash is very old; note the copyright date:

    % /bin/bash --version
    GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
    Copyright (C) 2007 Free Software Foundation, Inc.

A recent bash installed manually (not from Apple):

    % /usr/local/bin/bash --version
    GNU bash, version 4.4.18(1)-release (x86_64-apple-darwin16.7.0)
    Copyright (C) 2016 Free Software Foundation, Inc.
Specifically, Apple ships the latest version of Bash 3.x, which is the
last version published under the GPLv2+ – Bash 4.x switched to GPLv3+.
Users can install newer Bash versions themselves, e. g. using Homebrew,
but that doesn’t help us here.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help