branch: elpa/git-commit commit e62ecd3ce7d05de31ddfb1e1b4af9e61de10a5d4 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
magit-clone-url-format: Use t as the default key Like for cond et al. --- docs/magit.org | 2 +- docs/magit.texi | 2 +- lisp/magit-clone.el | 18 ++++++++++-------- test/magit-tests.el | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/magit.org b/docs/magit.org index a297da00c2..06182125e2 100644 --- a/docs/magit.org +++ b/docs/magit.org @@ -4337,7 +4337,7 @@ The following suffixes are disabled by default. See name, including the name of the owner. The value can be a string (representing a single static format) or an alist with elements ~(HOSTNAME . FORMAT)~ mapping hostnames to formats. When an alist - is used, the ~nil~ key represents the default format. + is used, the ~t~ key represents the default format. Example of a single format string: diff --git a/docs/magit.texi b/docs/magit.texi index 0e6b52bada..fb1ff7f7e8 100644 --- a/docs/magit.texi +++ b/docs/magit.texi @@ -5393,7 +5393,7 @@ names into urls. @code{%h} is the hostname and @code{%n} is the repository name, including the name of the owner. The value can be a string (representing a single static format) or an alist with elements @code{(HOSTNAME . FORMAT)} mapping hostnames to formats. When an alist -is used, the @code{nil} key represents the default format. +is used, the @code{t} key represents the default format. Example of a single format string: diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el index bd88ad6b73..26e616579b 100644 --- a/lisp/magit-clone.el +++ b/lisp/magit-clone.el @@ -94,17 +94,19 @@ as the username itself." (defcustom magit-clone-url-format "git@%h:%n.git" "Format(s) used when turning repository names into urls. -%h is the hostname and %n is the repository name, including the -name of the owner. The value can be a string (representing a -single static format) or an alist with elements (HOSTNAME -. FORMAT) mapping hostnames to formats. When an alist is used, -the nil key represents the default. Also see -`magit-clone-name-alist'." + +In a format string, %h is the hostname and %n is the repository +name, including the name of the owner. + +The value can be a string (representing a single static format) +or an alist with elements (HOSTNAME . FORMAT) mapping hostnames +to formats. When an alist is used, the t key represents the +default. Also see `magit-clone-name-alist'." :package-version '(magit . "3.4.0") :group 'magit-commands :type '(choice (string :tag "Format") (alist :key-type (choice (string :tag "Host") - (const :tag "Default" nil)) + (const :tag "Default" t)) :value-type (string :tag "Format")))) ;;; Commands @@ -321,7 +323,7 @@ Then show the status buffer for the new repository." (if-let ((url-format (cond ((listp magit-clone-url-format) (cdr (or (assoc host magit-clone-url-format) - (assoc nil magit-clone-url-format)))) + (assoc t magit-clone-url-format)))) ((stringp magit-clone-url-format) magit-clone-url-format)))) (format-spec diff --git a/test/magit-tests.el b/test/magit-tests.el index 9f2208b93d..da99d1df6f 100644 --- a/test/magit-tests.el +++ b/test/magit-tests.el @@ -330,7 +330,7 @@ Enter passphrase for key '/home/user/.ssh/id_rsa': " ("\\`\\(?:gh:\\)?\\([^:]+\\)\\'" "github.com" "u"))) (magit-clone-url-format '(("git.example.com" . "cow@%h:~%n") - (nil . "git@%h:%n.git")))) + (t . "git@%h:%n.git")))) (should (string-equal (magit-clone--name-to-url "gh:a/b") "g...@github.com:a/b.git")) (should (string-equal (magit-clone--name-to-url "ex:a/b")