aboutsummaryrefslogtreecommitdiff
path: root/lisp/magit-remote.el
diff options
context:
space:
mode:
authorBen North <ben@redfrontdoor.org>2020-06-27 09:06:48 +0100
committerBen North <ben@redfrontdoor.org>2020-06-27 09:06:48 +0100
commit9e35f9892ca3987d979a6212ff79b23ddbb42103 (patch)
treeacad87d302ac1f385bfccd0cc33f6982d790dd8f /lisp/magit-remote.el
parent33052629031f58b5e4e6307471392a664f24be6a (diff)
magit-remote-add: Handle lack of "origin" remote
It is possible for a repo to have no remote called "origin". In this case, magit-remote-add fails when attempting to construct a suggestion for the to-be-added remote's URL. Check that we have an "origin" remote URL before using it.
Diffstat (limited to 'lisp/magit-remote.el')
-rw-r--r--lisp/magit-remote.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index ecbad18..5d2bf80 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -104,7 +104,8 @@ has to be used to view and change remote related variables."
(list remote
(magit-read-url
"Remote url"
- (and (string-match "\\([^:/]+\\)/[^/]+\\(\\.git\\)?\\'" origin)
+ (and origin
+ (string-match "\\([^:/]+\\)/[^/]+\\(\\.git\\)?\\'" origin)
(replace-match remote t t origin 1)))
(transient-args 'magit-remote))))
(if (pcase (list magit-remote-add-set-remote.pushDefault