Re: [PATCH v2 3/8] git-prompt: don't use shell arrays
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 16, 2024, 08:50 UTC
- Message-ID
- <Zr8Swsn3H2ebB7g6@tanuki>
- In-Reply-To
- <7e994eae7bc3dfa021262410c801ddb124ce24f1.1723727653.git.gitgitgadget@gmail.com>
On Thu, Aug 15, 2024 at 01:14:08PM +0000, Avi Halachmi (:avih) via GitGitGadget wrote:
Show 23 quoted lines
> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> index 4cc2cf91bb6..75c3a813fda 100644
> --- a/contrib/completion/git-prompt.sh
> +++ b/contrib/completion/git-prompt.sh
> @@ -116,10 +116,10 @@ printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1
> __git_ps1_show_upstream ()
> {
> local key value
> - local svn_remote svn_url_pattern="" count n
> + local svn_remotes="" svn_url_pattern="" count n
> local upstream_type=git legacy="" verbose="" name=""
> + local LF=$'\n'
>
> - svn_remote=()
> # get some config options from git-config
> local output="$(git config -z --get-regexp '^(svn-remote\..*\.url|bash\.showupstream)$' 2>/dev/null | tr '\0\n' '\n ')"
> while read -r key value; do
> @@ -132,7 +132,7 @@ __git_ps1_show_upstream ()
> fi
> ;;
> svn-remote.*.url)
> - svn_remote[$((${#svn_remote[@]} + 1))]="$value"
> + svn_remotes=${svn_remotes}${value}${LF} # URI\nURI\n...I was wondering whether this is something we want to quote, mostly because I still have the failures of dash in mind when assigning values with spaces to a `local` variable without quoting. I do not know whether the same issues also apply to non-local variables though, probably not.
Patrick