X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/e3165b45a31d715d5f499222bcacad1527de9c9e..49a6af92db204536f6752583c1c24a34c1070c8c:/vcsh diff --git a/vcsh b/vcsh index 5d502e7..a6d8213 100755 --- a/vcsh +++ b/vcsh @@ -152,15 +152,17 @@ clone() { exit fi git fetch - for object in $(git ls-tree -r origin/master | awk '{print $4}'); do + hook pre-merge + git ls-tree -r --name-only origin/master | (while read object; do [ -e "$object" ] && error "'$object' exists." && VCSH_CONFLICT=1 done - [ "$VCSH_CONFLICT" = '1' ] && + [ "$VCSH_CONFLICT" = '1' ]) && fatal "will stop after fetching and not try to merge! Once this situation has been resolved, run 'vcsh run $VCSH_REPO_NAME git pull' to finish cloning." 17 git merge origin/master + hook post-merge hook post-clone retire hook post-clone-retired @@ -416,7 +418,7 @@ esac if [ "$VCSH_COMMAND" = 'clone' ]; then [ -z "$2" ] && fatal "$VCSH_COMMAND: please specify a remote" 1 GIT_REMOTE="$2" - [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "$GIT_REMOTE" .git) + [ -n "$3" ] && VCSH_REPO_NAME="$3" || VCSH_REPO_NAME=$(basename "${GIT_REMOTE#*:}" .git) [ -z "$VCSH_REPO_NAME" ] && fatal "$VCSH_COMMAND: could not determine repository name" 1 export VCSH_REPO_NAME export GIT_DIR="$VCSH_REPO_D/$VCSH_REPO_NAME.git"