summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2019-02-16 00:53:05 -0500
committerKyle Meyer <kyle@kyleam.com>2019-02-16 01:16:47 -0500
commitd20cdca50157b602f249642ff8244b0e0fc7643d (patch)
tree6977fe279bb594de8076046a00ca359e31bd75d8
parent64c2a42263c7b5f2e4d16d07e58b1fc06ffbca7b (diff)
downloademacs.d-d20cdca50157b602f249642ff8244b0e0fc7643d.tar.gz
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.
-rw-r--r--lisp/km-magit.el15
1 files 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)