From 6a23dc6cea4913d3184aebb74ced13261d47a130 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan <caleb@alerque.com> Date: Wed, 22 May 2013 21:06:36 +0300 Subject: [PATCH] Change handling of conflicts to keep extant local objects. --- vcsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vcsh b/vcsh index 2509b66..c4f4958 100755 --- a/vcsh +++ b/vcsh @@ -140,15 +140,16 @@ clone() { exit fi git fetch + # TODO: find a way to do this with less tool dependencies and cludges, possibly + # utilizing `git stash` to store local changes before merging (stash can't be + # used on a fresh clone without at least one commit) for object in $(git ls-tree -r origin/master | awk '{print $4}'); do [ -e "$object" ] && - error "'$object' exists." && + mv "$object" "$object.vcsh-unclobber" VCSH_CONFLICT=1; done - [ "$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.\n" 17 git merge origin/master + [ "$VCSH_CONFLICT" = '1' ] && find -name '*.vcsh-unclobber' -execdir rename .vcsh-unclobber '' {} \; } delete() { -- GitLab