From: Richard Hartmann Date: Wed, 23 Nov 2011 17:02:44 +0000 (+0100) Subject: Re-arrange functions X-Git-Url: https://git.madduck.net/code/vcsh.git/commitdiff_plain/663af6efe8d81d4386127b8fbd05320f44988658 Re-arrange functions --- 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"