summaryrefslogtreecommitdiff
path: root/asp.in
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-07-31 20:41:38 -0400
committerDave Reisner <dreisner@archlinux.org>2014-07-31 20:41:38 -0400
commit92df942545fb2536b42b7c63f45d3293db326754 (patch)
treee99d00cfb0991da110af99dd56fc0e9e2e6e3b72 /asp.in
parent93883e62b3228071cd9d15a7e9c49a1840611b26 (diff)
downloadasp32-92df942545fb2536b42b7c63f45d3293db326754.tar.xz
add hack to migrate bare repos to repos con arboles
Diffstat (limited to 'asp.in')
-rw-r--r--asp.in21
1 files 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