Re: bash: unescaped `>` character when switching branches
- From
- Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
- Date
- Jun 25, 2025, 08:53 UTC
- Message-ID
- <8515698b-4ab7-4901-bacb-1c47180c2530@app.fastmail.com>
- In-Reply-To
- <CA+B51BHEB24JNzOroTxFodxiuPJ1=Vj7KRFevrm2YatnTVuoYA@mail.gmail.com>
On Tue, Jun 24, 2025, at 14:59, Ondrej Pohorelsky wrote:
Show 13 quoted lines
> Hi, > > Our customer has found a possible issue when switching branches. > Output redirection character `>` is not escaped properly when > switching/checking out to different branch. > > Steps to reproduce: > 1. Create a new branch and switch back to master > ``` > $ git switch -C 'issue#1234>/tmp/dangerfile' > Switched to a new branch 'issue#1234>/tmp/dangerfile' > $ git switch master > ```
It’s too bad that git-check-ref-format(1) does not disallow `>`.
It would be nice to have an opt-in extension to the ref format check which disallows `>`.