summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/km-magit.el25
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 0cfbf2c..7f339cd 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -220,25 +220,24 @@ START-POINT set to the current branch.
(error "bug: version re should always match"))))
(km/magit-branch-get-set branch suffix)))))
-(defun km/magit-branch-backup-current (&optional choose-suffix)
+(defun km/magit-branch-backup-current (&optional suffix)
"Create a backup branch for the current branch.
Name it as '<current-branch>__v<n>', where <n> is incremented
to form a refname that doesn't already exist. With the prefix
-argument CHOOSE-SUFFIX, prompt for a suffix to use instead of
+argument SUFFIX, prompt for a suffix to use instead of
'v'."
- (interactive "P")
- (let ((current (or (magit-get-current-branch)
- (user-error "No current branch"))))
+ (interactive (list (and current-prefix-arg
+ (magit-read-string-ns "Backup suffix"))))
+ (setq suffix (or suffix "v"))
+ (let* ((current (or (magit-get-current-branch)
+ (user-error "No current branch")))
+ (versions (km/magit-branch--get-versions current suffix)))
(magit-run-git
"branch" "--copy"
- (let* ((suffix (if choose-suffix
- (magit-read-string-ns "Backup suffix")
- "v"))
- (versions (km/magit-branch--get-versions current suffix)))
- (format "%s__%s%d"
- current
- suffix
- (if (null versions) 1 (1+ (apply #'max versions))))))))
+ (format "%s__%s%d"
+ current
+ suffix
+ (if (null versions) 1 (1+ (apply #'max versions)))))))
(defun km/magit-branch-archive (branches)
"Move BRANCHES from refs/heads/ to refs/archive/."