From: W. Trevor King Date: Wed, 30 Nov 2011 21:08:33 +0000 (-0500) Subject: Use subshell and 'cd' instead of --git-dir and --work-tree for 'git pull'. X-Git-Tag: v0.3~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e0b7d85e30f9712686642f866a4d65aa45e3d278;p=dotfiles-framework.git Use subshell and 'cd' instead of --git-dir and --work-tree for 'git pull'. I was getting: git-pull cannot be used without a working tree Possibly a bug in git, but using a subshell is simple enough. --- diff --git a/dotfiles.sh b/dotfiles.sh index f400bc7..d1305dd 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -315,7 +315,7 @@ function fetch() get_repo_source "${REPO}" || return 1 TRANSFER=$(nonempty_option 'fetch' 'TRANSFER' "${REPO_SOURCE_DATA['transfer']}") || return 1 if [ "${TRANSFER}" = 'git' ]; then - "${GIT}" --git-dir "${REPO}/.git" --work-tree "${REPO}" pull || return 1 + (cd "${REPO}" && "${GIT}" pull) || return 1 elif [ "${TRANSFER}" = 'wget' ]; then wget_fetch "${REPO}" || return 1 else