Re: [PATCH 3/3] git-prompt: add quiet upstream indicator option
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 20, 2025, 18:05 UTC
- Message-ID
- <CAPig+cTpDdTceBSYoVRBS7wKoSxURMeTA7TruiAmjgTX4B=m5w@mail.gmail.com>
- In-Reply-To
- <CALnO6CBzE-+51LfgjpEv665oG6kZG9_4YZTv8qgqtNrhh+a-Bw@mail.gmail.com>
On Thu, Nov 20, 2025 at 11:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
Show 12 quoted lines
> On Sat, Nov 15, 2025 at 1:55 PM Kiril Ivanov via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
> > @@ -275,6 +279,8 @@ __git_ps1_show_upstream ()
> > "0 0") # equal to upstream
> > + [ "$quiet" ] &&
> > + upstream="|u" ||
> > upstream="|u=" ;;
> > "0 "*) # ahead of upstream
> > upstream="|u+${count#0 }" ;;
>
> Our coding style also prefers "test" to "[".In this bash-specific script, the normal project coding style is relaxed and `[` is used regularly, far more so than `test`, so use of `[` here is appropriate and consistent with surrounding code.