From: W. Trevor King Date: Thu, 1 Dec 2011 15:05:56 +0000 (-0500) Subject: Relax no-associative-array bailout on fetch by assuming Git. X-Git-Tag: v0.3~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c7a653ae9c5a04dd156e386c7b6b07a6f2c2b13b;p=dotfiles-framework.git Relax no-associative-array bailout on fetch by assuming Git. --- diff --git a/dotfiles.sh b/dotfiles.sh index a0f629b..7386fc4 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -122,7 +122,7 @@ fi function set_repo_source() { if [ "${BASH_MAJOR}" -lt 4 ]; then - echo "ERROR: ${0} requires Bash version >= 4.0 for source_cache" >&2 + echo "ERROR: ${0}'s set_repo_source requires Bash version >= 4.0" >&2 echo "you're running ${BASH}, which doesn't support associative arrays" >&2 return 1 fi @@ -137,7 +137,7 @@ function set_repo_source() function get_repo_source() { if [ "${BASH_MAJOR}" -lt 4 ]; then - echo "ERROR: ${0} requires Bash version >= 4.0 for source_cache support" >&2 + echo "ERROR: ${0}'s get_repo_source() requires Bash version >= 4.0" >&2 echo "you're running ${BASH}, which doesn't support associative arrays" >&2 return 1 fi @@ -328,8 +328,13 @@ function fetch() # multi-repo case handled in main() by run_on_all_repos() REPO=$(nonempty_option 'fetch' 'REPO' "${1}") || return 1 maxargs 'fetch' 1 "${@}" || return 1 - get_repo_source "${REPO}" || return 1 - TRANSFER=$(nonempty_option 'fetch' 'TRANSFER' "${REPO_SOURCE_DATA['transfer']}") || return 1 + if [ "${BASH_MAJOR}" -ge 4 ]; then + get_repo_source "${REPO}" || return 1 + TRANSFER=$(nonempty_option 'fetch' 'TRANSFER' "${REPO_SOURCE_DATA['transfer']}") || return 1 + else + echo "WARNING: Bash version < 4.0, assuming all repos use git transfer" >&2 + TRANSFER='git' + fi if [ "${TRANSFER}" = 'git' ]; then (cd "${REPO}" && "${GIT}" pull) || return 1 elif [ "${TRANSFER}" = 'wget' ]; then