Johannes Schindelin 0c3ca441d7 filesystem(bashrc): avoid spawning an external process
In 73e06b9d4c (bash.bashrc: Update PS1 if PS1 wasn't exported. Closes
 #653, 2016-07-14), we updated `/etc/bash.bashrc` to avoid overriding
`PS1`, but the way it was done requires `cut.exe` to be in the `PATH`.

Now, while _most_ of the time we're running inside a login Bash where
the `PATH` has been appropriately modified, sometimes we don't. In that
case, `cut.exe` is not in the `PATH`.

We should not spawn a new process, anyway, as spawning processes is
really expensive in the MSYS2 runtime because of all the contortions
necessary to emulate the POSIX syscall `fork()`.

Let's just avoid that extra process by using `case`, which is a Bash
built-in and therefore won't cost much time to run.

This fixes https://github.com/git-for-windows/git/issues/3652

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-02-01 17:18:40 +01:00
..
2019-01-22 13:50:19 +03:00
2021-04-07 21:38:50 -07:00
2021-06-04 13:11:18 -07:00