From: Joey Hess Date: Fri, 26 Oct 2007 01:34:48 +0000 (-0400) Subject: some fixes to bare and fake-bare registering X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/8a2f5442b876c2bcf8890fa080dc479e6159f588?hp=bba0730143212b171b7bb9b2bdec04c4fb1aad33 some fixes to bare and fake-bare registering --- diff --git a/mr b/mr index 3dbacf0..80b423f 100755 --- a/mr +++ b/mr @@ -1159,8 +1159,6 @@ git_bare_register = if [ -z "$url" ]; then error "cannot determine git url" fi - mr -c "$MR_CONFIG" config "`pwd`" \ - lib="GIT_WORK_TREE=$work_tree; export GIT_WORK_TREE" echo "Registering git url: $url in $MR_CONFIG" mr -c "$MR_CONFIG" config "`pwd`" checkout="git clone --bare $url $MR_REPO" git_fake_bare_register = @@ -1169,6 +1167,9 @@ git_fake_bare_register = error "cannot determine git url" fi worktree="$(git-config --get core.worktree)" || true + if [ -z "$worktree" ]; then + error "git worktree is not set" + fi worktree="${worktree%%/}/" if [ ! -d "$worktree" ]; then error "git worktree $worktree does not exist" @@ -1177,13 +1178,14 @@ git_fake_bare_register = lib="GIT_WORK_TREE=$work_tree; export GIT_WORK_TREE" echo "Registering git url: $url in $MR_CONFIG (with worktree $worktree)" mr -c "$MR_CONFIG" config "`pwd`" \ - checkout=" - git clone --no-checkout $url $MR_REPO - cd $MR_REPO - git read-tree HEAD - git checkout-index -a --prefix='$work_tree' || true - git config core.worktree '$worktree'" - mv .git/* . && rmdir .git" + checkout=" \ + git clone --no-checkout $url $MR_REPO && \ + cd $MR_REPO && \ + git read-tree HEAD && \ + git checkout-index -a --prefix='$work_tree' || true; \ + git config core.worktree '$worktree' && \ + mv .git/* . && \ + rmdir .git" help = if [ ! -e "$MR_PATH" ]; then