[PATCH 1/8] git-prompt: use here-doc instead of here-string
- From
- Avi Halachmi (:avih) via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jul 23, 2024, 19:18 UTC
- Message-ID
- <9ce5ddadf0bb13229461d67451094a373348771e.1721762306.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1750.git.git.1721762306.gitgitgadget@gmail.com>
From: "Avi Halachmi (:avih)" <avihpit@yahoo.com>
Here-documend is standard, and works in all shells.
Both here-string and here-doc add final newline, which is important in this case, because $output is without final newline, but we do want "read" to succeed on the last line as well.
Shells which support here-string: - bash, zsh, mksh, ksh93, yash (non-posix-mode).
shells which don't, and got fixed: - ash-derivatives (dash, free/net bsd sh, busybox-ash). - pdksh, openbsd sh. - All Schily Bourne shell variants.
Signed-off-by: Avi Halachmi (:avih) <avihpit@yahoo.com> --- contrib/completion/git-prompt.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index 5330e769a72..ebf2e30d684 100644 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@ -137,7 +137,9 @@ __git_ps1_show_upstream () upstream_type=svn+git # default upstream type is SVN if available, else git ;; esac - done <<< "$output" + done <<-OUTPUT + $output + OUTPUT # parse configuration values local option
-- gitgitgadget