]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-prompt: use here-doc instead of here-string
authorAvi Halachmi (:avih) <avihpit@yahoo.com>
Tue, 20 Aug 2024 01:48:25 +0000 (01:48 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Aug 2024 15:28:17 +0000 (08:28 -0700)
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>
contrib/completion/git-prompt.sh

index 5330e769a72a86df6c4d2e47d796bc4e0cb90773..ebf2e30d68465806c748987aa36f9a50a99eae95 100644 (file)
@@ -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