From 0e2dbae33a788c92e1bcb3b4883d5be7ce2281be Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Thu, 31 Jul 2014 11:40:58 -0400 Subject: add 'untrack' verb --- asp.in | 12 ++++++++++++ man/asp.1.txt | 5 +++++ remote.inc.sh | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/asp.in b/asp.in index 5393823..1c4902e 100644 --- a/asp.in +++ b/asp.in @@ -63,6 +63,7 @@ Commands: log NAME Show revision history shortlog NAME Show revision history in short form update [NAME...] Update packages (update all tracked if none specified) + untrack NAME... Remove a package from the local repository EOF } @@ -156,6 +157,14 @@ gc() { git gc } +untrack() { + local pkgname=$1 remote + + package_init -n "$pkgname" remote || return 1 + + remote_untrack "$remote" "$pkgname" +} + disk_usage() { local usage read usage _ < <(du -sh "$ASPROOT/objects") @@ -235,6 +244,9 @@ case $action in gc) gc ;; + untrack) + map untrack "$@" + ;; help) usage exit 0 diff --git a/man/asp.1.txt b/man/asp.1.txt index 3a90780..f94fe8c 100644 --- a/man/asp.1.txt +++ b/man/asp.1.txt @@ -67,6 +67,11 @@ The following commands are understood: to the newest version. If no targets are provided, all locally known packages will be updated. +*untrack*:: + Remove a remote tracking branch from the local repository. Disk usage for + the removed package(s) may not be freed until garbage collection has taken + place. + Options ------- *-a* 'architecture':: diff --git a/remote.inc.sh b/remote.inc.sh index b125419..d2521bb 100644 --- a/remote.inc.sh +++ b/remote.inc.sh @@ -48,3 +48,9 @@ remote_get_url() { git ls-remote --get-url "$remote" } + +remote_untrack() { + local remote=$1 pkgname=$2 + + git branch -dr "$remote/packages/$pkgname" +} -- cgit v1.2.3-54-g00ecf