From 92df942545fb2536b42b7c63f45d3293db326754 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 31 Jul 2014 20:41:38 -0400 Subject: add hack to migrate bare repos to repos con arboles --- asp.in | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/asp.in b/asp.in index ccb2c75..fcf16b0 100644 --- a/asp.in +++ b/asp.in @@ -95,14 +95,27 @@ update_packages() { done } +migrate_bare_repo() { + files=(branches hooks info objects logs refs config description + {FETCH_,}HEAD) + + { # figure out when to get rid of this + git config 'core.bare' 'false' + mkdir .git + mv "${files[@]}" .git + } 2>/dev/null +} + initialize() { local remote - if [[ -d .git && OPT_FORCE -eq 0 ]]; then - log_fatal 'refusing to overwrite existing repo in %s' "$ASPROOT" + if [[ -s config && $(git config core.bare) = 'true' ]]; then + migrate_bare_repo fi - git init --bare || return 1 + [[ -f .asp ]] && return 0 + + git init || return 1 for remote in "${ARCH_GIT_REPOS[@]}"; do rm -rf "$remote" @@ -175,7 +188,7 @@ disk_usage() { umask 0022 startdir=$PWD cd "$ASPROOT" || log_fatal "ASPROOT ($ASPROOT) does not exist!" -[[ -f .asp ]] || initialize +initialize while getopts ':a:fhV' flag; do case $flag in -- cgit v1.2.3-70-g09d2