X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/ccb770603b504ce05c8abc0282b4b3caed70fe8f..663af6efe8d81d4386127b8fbd05320f44988658:/vcsh diff --git a/vcsh b/vcsh index c8618f1..cb9f216 100755 --- a/vcsh +++ b/vcsh @@ -44,18 +44,6 @@ verbose() { if [ -n "$VCSH_DEBUG" ] || [ -n "$VCSH_VERBOSE" ]; then echo "$SELF: verbose: $@"; fi } -use() { - verbose "use() begin" - if [ ! -d "$GIT_DIR" ]; then - echo E: no repository found for "$VCSH_REPO_NAME" >&2 - return 1 - fi - export GIT_DIR - export GIT_WORK_TREE="$(git config --get core.worktree)" - export VCSH_DIRECTORY="$VCSH_REPO_NAME" - verbose "use() end" -} - init() { verbose "init() begin" [ -e "$GIT_DIR" ] && @@ -81,6 +69,18 @@ leave() { unset VCSH_DIRECTORY } +use() { + verbose "use() begin" + if [ ! -d "$GIT_DIR" ]; then + echo E: no repository found for "$VCSH_REPO_NAME" >&2 + return 1 + fi + export GIT_DIR + export GIT_WORK_TREE="$(git config --get core.worktree)" + export VCSH_DIRECTORY="$VCSH_REPO_NAME" + verbose "use() end" +} + if [ "$1" = 'clone' ]; then export VCSH_COMMAND="$1"