bash-powerline icon indicating copy to clipboard operation
bash-powerline copied to clipboard

Use a function to wrap git

Open robin-engineml opened this issue 6 years ago • 9 comments

This allows bash-powerline to work on macOS, which has Bash 3.

robin-engineml avatar May 05 '19 08:05 robin-engineml

@riobard Are you accepting PRs in this repo?

robin-engineml avatar Jun 10 '19 22:06 robin-engineml

Could you please explain a little bit why this PR is needed? The current code works with Bash 3 on macOS.

riobard avatar Jun 10 '19 22:06 riobard

@riobard No, the current code does not work on macOS with Bash 3. That is why I submitted this PR. The current code silently fails, looking for a binary with name "env LANG=C git".

robin-engineml avatar Jun 11 '19 13:06 robin-engineml

That's strange. What's the version of your macOS and its bash?

riobard avatar Jun 11 '19 18:06 riobard

Bash is "3.2.57(1)-release (x86_64-apple-darwin18)" and macOS version is 10.14.5.

robin-engineml avatar Jun 11 '19 18:06 robin-engineml

Easy to repro:

$ prog="X=Y ls"
$ $prog
-bash: X=Y ls: command not found

robin-engineml avatar Jun 11 '19 18:06 robin-engineml

No, you're doing it wrong. Try cmd="env LANG=C git and run $cmd. It definitely works unless your $PATH is screwed.

riobard avatar Jun 11 '19 18:06 riobard

$ cmd="env X=Y ls"
$ $cmd
-bash: env X=Y ls: command not found

robin-engineml avatar Jun 11 '19 22:06 robin-engineml

I guess your bash might be misconfigured.

bash-3.2$ uname -a
Darwin Mac-mini 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
bash-3.2$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2$ cmd="env LANG=C git"
bash-3.2$ $cmd --version
git version 2.20.1 (Apple Git-117)
bash-3.2$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

riobard avatar Jun 12 '19 08:06 riobard