From 8a2f5442b876c2bcf8890fa080dc479e6159f588 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 25 Oct 2007 21:34:48 -0400 Subject: [PATCH 1/1] some fixes to bare and fake-bare registering --- mr | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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 -- 2.39.5