summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2024-02-29 00:47:11 +0100
committerLevente Polyak <anthraxx@archlinux.org>2024-02-29 21:20:31 +0100
commit354c9dcd123711191f77813acf35343e8a4849eb (patch)
treecf1e00f82a62e435d096ac8ff82e5d6efe80dbe1
parent39eaeaa4b2e021ec44cc63c70493f9c9ef0c8ba4 (diff)
downloaddevtools-354c9dcd123711191f77813acf35343e8a4849eb.tar.xz
fix(drop-from-repo): avoid error when updating remote head
We can only update the local ref to the remote head from main to master once we have actually pushed the master branch to the remote. If we do this too early, the call will simply error out. Instead, only update the local head for the configured remote after we have successfully renamed the branch and pushed it to the AUR. Fixes #212 Component: pkgctl aur drop-from-repo Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--src/lib/aur/drop-from-repo.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/aur/drop-from-repo.sh b/src/lib/aur/drop-from-repo.sh
index d70b559..6ebe12a 100644
--- a/src/lib/aur/drop-from-repo.sh
+++ b/src/lib/aur/drop-from-repo.sh
@@ -120,7 +120,6 @@ pkgctl_aur_drop_from_repo() {
if [[ $(git symbolic-ref --quiet --short HEAD) == main ]]; then
git branch --move master
git config branch.master.merge refs/heads/master
- git remote set-head origin master
fi
# auto generate .SRCINFO if not already present
@@ -142,6 +141,9 @@ pkgctl_aur_drop_from_repo() {
git push origin master
fi
+ # update the local default branch in case this clone is used in the future
+ git remote set-head origin master
+
if (( DISOWN )); then
msg "Disowning ${pkgbase} on the AUR"
# shellcheck disable=SC2029