diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -147,6 +147,16 @@ exit 1 } +# +# Fetch the value of a boolean config variable ($1) and return true +# (0) if the variable is true. The default value to use if the +# variable is not set is passed in $2. +# +get_bool_config() +{ + test "$(git config --bool --get $1 2>/dev/null || echo $2)" != "false" +} + # # Filter the output of call-conduit to remove the warnings that are generated # for some installations where openssl module is mysteriously installed twice so @@ -378,7 +388,7 @@ list= prev="" - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -672,7 +682,7 @@ local commit commits diff doprompt have_msg list o msg list= - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -727,7 +737,7 @@ set -e ASSUME_YES= -if [ "$(git config --bool --get arc.assume-yes 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.assume-yes false; then ASSUME_YES=1 fi @@ -801,7 +811,7 @@ ;; esac -if [ "$(git config --bool --get arc.browse 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.browse false; then BROWSE=--browse fi