summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-09-11 12:18:03 -0400
committerDave Reisner <dreisner@archlinux.org>2014-09-11 12:18:03 -0400
commit5813547dbcd190c6d7e69d61d3a15cd1e8805282 (patch)
tree9f84c63f7ccca46c028b3367e1ba3b4428228029
parente3dc5f7cb77942fdac1fa02ee41669341bd7b67b (diff)
downloadasp32-5813547dbcd190c6d7e69d61d3a15cd1e8805282.tar.xz
re-point local tracking branches on 'asp update'
This ensures that 'git pull' works in a checked-out repo after an update. https://bbs.archlinux.org/viewtopic.php?pid=1455457#p1455457
-rw-r--r--asp.in16
1 files changed, 15 insertions, 1 deletions
diff --git a/asp.in b/asp.in
index 74165b3..b28b8fa 100644
--- a/asp.in
+++ b/asp.in
@@ -55,7 +55,17 @@ update_all() {
done
}
-update_packages() {
+update_local_branches() {
+ local r=0
+
+ while read -r branchname; do
+ git branch -qf "$branchname" "refs/remotes/$branchname" || r=1
+ done < <(git branch)
+
+ return "$r"
+}
+
+update_remote_branches() {
local refspecs=() remote pkgname
declare -A refspec_map
@@ -77,6 +87,10 @@ update_packages() {
done
}
+update_packages() {
+ update_remote_branches "$@" && update_local_branches
+}
+
migrate_bare_repo() {
files=(branches hooks info objects logs refs config description
{FETCH_,}HEAD)