From b6d7f36a7d73b6d4fddab876d2817ec4837b0ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= Date: Sat, 10 Apr 2010 21:17:27 +0200 Subject: [PATCH] When there is a guessed branch, it make a good default rev. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Vanicat --- magit.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/magit.el b/magit.el index d1631a6d..8aab085d 100644 --- a/magit.el +++ b/magit.el @@ -591,7 +591,13 @@ Many Magit faces inherit from this one by default." (format "%s at %s" things (magit-rev-describe (car range)))))) (defun magit-default-rev () - (magit-name-rev (magit-commit-at-point t))) + (or (magit-name-rev (magit-commit-at-point t)) + (let ((branch (magit-guess-branch))) + (if branch + (if (string-match "^refs/\\(.*\\)" branch) + (match-string 1 branch) + branch))))) + ;;; Sections