From f55bcdfd30a696a7f38d9dd757be5366778f3699 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 24 Feb 2020 19:58:03 -0500 Subject: [PATCH] Have browse-to-remote default to master in detached repos Instead of producing links with nil branch. --- modules/emacs/vc/config.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/emacs/vc/config.el b/modules/emacs/vc/config.el index 348bc3ebe..3fea39ef2 100644 --- a/modules/emacs/vc/config.el +++ b/modules/emacs/vc/config.el @@ -71,3 +71,12 @@ otherwise in default state." (when (and (bound-and-true-p evil-mode) (bobp) (eolp)) (evil-insert-state))))) + + +;; HACK `browse-at-remote' produces urls with `nil' in them, when the repo +;; detached. This creates broken links. I think it is more sensible to at +;; least refer to master in those case. +(defadvice! +vc--fallback-to-master-branch-a () + "Return 'master' in detached state." + :after-until #'browse-at-remote--get-local-branch + "master")