Re: [PATCH 3/3] git-prompt: add quiet upstream indicator option
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Nov 20, 2025, 18:18 UTC
- Message-ID
- <CALnO6CDin=zO5EBU2fC7xj6N9ZtAw0ge=GC=TRtE=2dM65+UxQ@mail.gmail.com>
- In-Reply-To
- <CAPig+cTpDdTceBSYoVRBS7wKoSxURMeTA7TruiAmjgTX4B=m5w@mail.gmail.com>
On Thu, Nov 20, 2025 at 1:06 PM Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 18 quoted lines
>
> On Thu, Nov 20, 2025 at 11:10 AM D. Ben Knoble <ben.knoble@gmail.com> wrote:
> > 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.Good to know, thanks! That'll teach me to respond without looking at surrounding context ;)
-- D. Ben Knoble