From: Gustav HÃ¥llberg Date: Fri, 4 Dec 2009 07:55:03 +0000 (+0100) Subject: stgit.el: Get default rebase branch from git-config in stg-rebase X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/d6e17ce04e5b6e766bec35f7c7e56d1b5139b307 stgit.el: Get default rebase branch from git-config in stg-rebase Signed-off-by: Gustav HÃ¥llberg --- diff --git a/contrib/stgit.el b/contrib/stgit.el index 0335d6d..3dd1989 100644 --- a/contrib/stgit.el +++ b/contrib/stgit.el @@ -1454,10 +1454,25 @@ If OMIT-STGIT is not nil, filter out \"resf/heads/*.stgit\"." result) result)))) +(defun stgit-parent-branch () + "Return the parent branch of the current stg branch as per +git-config setting branch..stgit.parentbranch." + (let ((output (with-output-to-string + (stgit-run-git-silent "config" + (format "branch.%s.stgit.parentbranch" + (stgit-current-branch)))))) + (when (string-match ".*" output) + (match-string 0 output)))) + (defun stgit-rebase (new-base) - "Rebase to NEW-BASE." + "Rebase the current branch to NEW-BASE. + +Interactively, first ask which branch to rebase to. Defaults to +what git-config branch..stgit.parentbranch is set to." (interactive (list (completing-read "Rebase to: " - (stgit-available-refs t)))) + (stgit-available-refs t) + nil nil + (stgit-parent-branch)))) (stgit-assert-mode) (stgit-capture-output nil (stgit-run "rebase" new-base)) (stgit-reload))