From d20cdca50157b602f249642ff8244b0e0fc7643d Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 16 Feb 2019 00:53:05 -0500 Subject: km/magit-branch-archive: Archive reflog as well This is useful information to have. magit-branch-shelve already does this. (It's one of the callers of the magit--rename-reflog-file helper.) At some point I should probably just switch to using magit-branch-shelve, which didn't exist when I added km/magit-branch-archive. The main differences are that they use a different ref namespace, magit-branch-shelve has a nice counterpart command for restoring the branch, and km/magit-branch-archive supports multiple ref selections. I do use the multi-ref feature a good amount from the refs buffer, but that might be pretty particular to my workflow and not something that should be added to magit-branch-shelve. --- lisp/km-magit.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 0ea2b02..332dc30 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -220,13 +220,14 @@ argument CHOOSE-SUFFIX, prompt for a suffix to use instead of branch))) branches)) (pcase-dolist (`(,branch-short . ,branch-full) branches) - (if (magit-git-success "update-ref" - (replace-regexp-in-string "refs/heads/" - "refs/archive/" - branch-full) - branch-full) - (magit-run-git "branch" "-D" branch-short) - (error "update-ref call failed"))) + (let ((new (replace-regexp-in-string "refs/heads/" + "refs/archive/" + branch-full))) + (if (magit-git-success "update-ref" new branch-full) + (progn + (magit--rename-reflog-file branch-full new) + (magit-run-git "branch" "-D" branch-short)) + (error "update-ref call failed")))) (message (concat "Archived " (let ((num-branches (length branches))) (if (= num-branches 1) -- cgit v1.2.3