mirror of
https://github.com/wfxr/forgit.git
synced 2026-09-10 07:16:23 -04:00
fix: compatibility check not working in bash (#258)
Fix: backwards compatibility check not working reliably in bash
This commit is contained in:
parent
4b251aab22
commit
bfea8cf485
|
|
@ -21,8 +21,10 @@ FORGIT="$INSTALL_DIR/bin/git-forgit"
|
|||
# backwards compatibility:
|
||||
# export all user-defined FORGIT variables to make them available in git-forgit
|
||||
unexported_vars=0
|
||||
# Set posix mode in bash to only get variables, see #256.
|
||||
[[ -n "$BASH_VERSION" ]] && set -o posix
|
||||
set | awk -F '=' '{ print $1 }' | grep FORGIT_ | while read -r var; do
|
||||
if ! export | grep -q "^$var="; then
|
||||
if ! export | grep -q "\(^$var=\|^export $var=\)"; then
|
||||
if [[ $unexported_vars == 0 ]]; then
|
||||
forgit::warn "Config options have to be exported in future versions of forgit."
|
||||
forgit::warn "Please update your config accordingly:"
|
||||
|
|
@ -33,6 +35,7 @@ set | awk -F '=' '{ print $1 }' | grep FORGIT_ | while read -r var; do
|
|||
export "$var"
|
||||
fi
|
||||
done
|
||||
[[ -n "$BASH_VERSION" ]] && set +o posix
|
||||
|
||||
# register shell functions
|
||||
forgit::log() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue