From 354c9dcd123711191f77813acf35343e8a4849eb Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Thu, 29 Feb 2024 00:47:11 +0100 Subject: 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 --- src/lib/aur/drop-from-repo.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2