git-prompt: use here-doc instead of here-string

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Avi Halachmi (:avih) committed Aug 20, 2024 at 01:48 UTC f037e607a875790dcadbba3f7a8fc185e2877792
1 file changed +3 -1
contrib/completion/git-prompt.sh
+3 -1
@@ -137,7 +137,9 @@ __git_ps1_show_upstream ()
137 upstream_type=svn+git # default upstream type is SVN if available, else git
138 ;;
139 esac
140 - done <<< "$output"
140 + done <<-OUTPUT
141 + $output
142 + OUTPUT
143
144 # parse configuration values
145 local option