summaryrefslogtreecommitdiffstats
path: root/acid/acid-source
diff options
context:
space:
mode:
Diffstat (limited to 'acid/acid-source')
-rwxr-xr-xacid/acid-source19
1 files changed, 15 insertions, 4 deletions
diff --git a/acid/acid-source b/acid/acid-source
index 351d3d0..8c62c44 100755
--- a/acid/acid-source
+++ b/acid/acid-source
@@ -37,13 +37,24 @@ if ! echo "$1" | grep -Eq '^[-_a-z0-9]*$'; then
fi
if ! [ -d "$1" ]; then
+ # New repository
git clone "$2" "$1" >&2 || fail
- touch "$1/.git/previous_hash"
- touch "$1/.git/previous_slug"
+ cd "$1"
+
+ # Strip down to tags and remote refs only
+ git remote set-head origin --delete >/dev/null 2>&1
+ git checkout HEAD~0 >/dev/null 2>&1
+ git for-each-ref --format='delete %(refname)' refs/heads \
+ | git update-ref --stdin >/dev/null 2>&1
+
+ # Init cyche metadata
+ touch ".git/previous_hash"
+ touch ".git/previous_slug"
+else
+ # Existing repository
+ cd "$1"
fi
-cd "$1"
-
git remote set-url origin "$2" >&2 # pick up url changes
git fetch --all --prune >&2 || fail