branch: elpa/git-commit
commit 196abe727054a440bf6262c5c254ad4565cbaa66
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    Use string-join instead of mapconcat
---
 lisp/git-commit.el      |  5 ++---
 lisp/magit-apply.el     |  6 ++----
 lisp/magit-base.el      | 11 +++++------
 lisp/magit-bookmark.el  | 10 +++++-----
 lisp/magit-branch.el    |  4 +---
 lisp/magit-diff.el      |  9 ++++-----
 lisp/magit-git.el       | 25 ++++++++++++-------------
 lisp/magit-log.el       |  4 ++--
 lisp/magit-merge.el     |  2 +-
 lisp/magit-process.el   |  6 +++---
 lisp/magit-reflog.el    |  4 +---
 lisp/magit-refs.el      |  4 ++--
 lisp/magit-status.el    |  2 +-
 lisp/magit-submodule.el |  2 +-
 test/magit-tests.el     |  2 +-
 15 files changed, 43 insertions(+), 53 deletions(-)

diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 7a0bb901da..f662d38910 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -1235,9 +1235,8 @@ Added to `font-lock-extend-region-functions'."
                       ;; because in repositories have thousands of
                       ;; branches that would be very slow.  See #4353.
                       (format "\\(\\(?:%s\\)\\|\\)\\([^']+\\)"
-                              (mapconcat #'identity
-                                         (magit-list-local-branch-names)
-                                         "\\|")))
+                              (string-join (magit-list-local-branch-names)
+                                           "\\|")))
                   "\\([^']*\\)"))
     (setq-local font-lock-multiline t)
     (add-hook 'font-lock-extend-region-functions
diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index bdac5e1388..81357ce287 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -187,10 +187,8 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 
@@\"."
     (magit-apply-patch
      file args
      (concat (oref file header)
-             (mapconcat #'identity
-                        (magit-apply--adjust-hunk-new-starts
-                         (mapcar #'magit-apply--section-content hunks))
-                        "")))))
+             (string-join (magit-apply--adjust-hunk-new-starts
+                           (mapcar #'magit-apply--section-content hunks)))))))
 
 (defun magit-apply-hunk (hunk &rest args)
   (let ((file (oref hunk parent)))
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index b4e34b569a..7c71870340 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -772,7 +772,7 @@ This is similar to `read-string', but
                   (let ((parts (nconc (list ,@(mapcar #'cadr clauses))
                                       ,(and verbose '(list "[C-g] to 
abort")))))
                     (concat ,prompt
-                            (mapconcat #'identity (butlast parts) ", ")
+                            (string-join (butlast parts) ", ")
                             ", or "  (car (last parts)) " "))
                   ',(mapcar #'car clauses))
             ,@(--map `(,(car it) ,@(cddr it)) clauses))
@@ -816,7 +816,7 @@ ACTION is a member of option `magit-slow-confirm'."
             ((length= items 1)
              (and (magit-y-or-n-p prompt action) items))
             ((length> items 1)
-             (and (magit-y-or-n-p (concat (mapconcat #'identity items "\n")
+             (and (magit-y-or-n-p (concat (string-join items "\n")
                                           "\n\n" prompt-n)
                                   action)
                   items)))
@@ -1191,10 +1191,9 @@ Magit."
                                     default-directory)))
                           (list (tramp-get-method-parameter
                                  vec 'tramp-remote-shell)
-                                (mapconcat #'identity
-                                           (tramp-get-method-parameter
-                                            vec 'tramp-remote-shell-args)
-                                           " "))))))
+                                (string-join (tramp-get-method-parameter
+                                              vec 'tramp-remote-shell-args)
+                                             " "))))))
            ,@body)
        ,@body)))
 
diff --git a/lisp/magit-bookmark.el b/lisp/magit-bookmark.el
index 1981912292..666acf1e21 100644
--- a/lisp/magit-bookmark.el
+++ b/lisp/magit-bookmark.el
@@ -65,7 +65,7 @@
             ('undefined
              (delq nil (list magit-buffer-typearg magit-buffer-range-hashed))))
           (if magit-buffer-diff-files
-              (concat " -- " (mapconcat #'identity magit-buffer-diff-files " 
"))
+              (concat " -- " (string-join magit-buffer-diff-files " "))
             "")))
 
 ;;;; Revision
@@ -79,7 +79,7 @@
   (format "magit-revision(%s %s)"
           (magit-rev-abbrev magit-buffer-revision)
           (if magit-buffer-diff-files
-              (mapconcat #'identity magit-buffer-diff-files " ")
+              (string-join magit-buffer-diff-files " ")
             (magit-rev-format "%s" magit-buffer-revision))))
 
 ;;;; Stash
@@ -93,7 +93,7 @@
   (format "magit-stash(%s %s)"
           (magit-rev-abbrev magit-buffer-revision)
           (if magit-buffer-diff-files
-              (mapconcat #'identity magit-buffer-diff-files " ")
+              (string-join magit-buffer-diff-files " ")
             (magit-rev-format "%s" magit-buffer-revision))))
 
 (cl-defmethod magit-bookmark--get-child-value
@@ -112,9 +112,9 @@
 
 (cl-defmethod magit-bookmark-name (&context (major-mode magit-log-mode))
   (format "magit-log(%s%s)"
-          (mapconcat #'identity magit-buffer-revisions " ")
+          (string-join magit-buffer-revisions " ")
           (if magit-buffer-log-files
-              (concat " -- " (mapconcat #'identity magit-buffer-log-files " "))
+              (concat " -- " (string-join magit-buffer-log-files " "))
             "")))
 
 ;;;; Cherry
diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el
index 2ffb80e09d..e313da4f78 100644
--- a/lisp/magit-branch.el
+++ b/lisp/magit-branch.el
@@ -434,9 +434,7 @@ when using `magit-branch-and-checkout'."
                  (if magit-completing-read--silent-default
                      (format "%s (starting at `%s')" prompt choice)
                    "Name for new branch")
-                 (let ((def (mapconcat #'identity
-                                       (cdr (split-string choice "/"))
-                                       "/")))
+                 (let ((def (string-join (cdr (split-string choice "/")) "/")))
                    (and (member choice (magit-list-remote-branch-names))
                         (not (member def (magit-list-local-branch-names)))
                         def)))
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 90cc8ddadb..bab9aeffeb 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -2002,8 +2002,7 @@ Staging and applying changes is documented in info node
                (0)
                (1 (concat " in file " (car magit-buffer-diff-files)))
                (_ (concat " in files "
-                          (mapconcat #'identity magit-buffer-diff-files
-                                     ", ")))))))
+                          (string-join magit-buffer-diff-files ", ")))))))
   (setq magit-buffer-range-hashed
         (and magit-buffer-range (magit-hash-range magit-buffer-range)))
   (magit-insert-section (diffbuf)
@@ -2396,7 +2395,7 @@ section or a child thereof."
                                      (or file orig)))
                            (format "--- %s\n" (or orig "/dev/null"))
                            (format "+++ %s\n" (or file "/dev/null")))))
-      (setq header (mapconcat #'identity header ""))
+      (setq header (string-join header))
       (magit-diff-insert-file-section
        file orig status modes rename header binary nil)))))
 
@@ -2578,7 +2577,7 @@ Staging and applying changes is documented in info node
              (0)
              (1 (concat " limited to file " (car magit-buffer-diff-files)))
              (_ (concat " limited to files "
-                        (mapconcat #'identity magit-buffer-diff-files ", 
"))))))
+                        (string-join magit-buffer-diff-files ", "))))))
   (magit-insert-section (commitbuf)
     (magit-run-section-hook 'magit-revision-sections-hook)))
 
@@ -3557,7 +3556,7 @@ last (visual) lines of the region."
         (forward-line)))
     (let ((buffer-list-update-hook nil)) ; #3759
       (with-temp-buffer
-        (insert (mapconcat #'identity (reverse patch) ""))
+        (insert (string-join (reverse patch)))
         (diff-fixup-modifs (point-min) (point-max))
         (setq patch (buffer-string))))
     patch))
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index a416313536..5e22cc7fef 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -772,7 +772,7 @@ See info node `(magit)Debugging Tools' for more 
information."
         (arg (and (or (null (car keys))
                       (string-prefix-p "--" (car keys)))
                   (pop keys)))
-        (key (mapconcat #'identity keys ".")))
+        (key (string-join keys ".")))
     (if (and magit--refresh-cache (not arg))
         (magit-config-get-from-cached-list key)
       (magit-git-items "config" arg "-z" "--get-all" key))))
@@ -783,7 +783,7 @@ Also see `magit-git-config-p'."
   (let ((arg (and (or (null (car keys))
                       (string-prefix-p "--" (car keys)))
                   (pop keys)))
-        (key (mapconcat #'identity keys ".")))
+        (key (string-join keys ".")))
     (equal (if magit--refresh-cache
                (car (last (magit-config-get-from-cached-list key)))
              (magit-git-str "config" arg "--bool" key))
@@ -794,7 +794,7 @@ Also see `magit-git-config-p'."
   (let ((arg (and (or (null (car keys))
                       (string-prefix-p "--" (car keys)))
                   (pop keys)))
-        (key (mapconcat #'identity keys ".")))
+        (key (string-join keys ".")))
     (if value
         (magit-git-success "config" arg key value)
       (magit-git-success "config" arg "--unset" key))
@@ -808,7 +808,7 @@ Also see `magit-git-config-p'."
   (let ((arg (and (or (null (car keys))
                       (string-prefix-p "--" (car keys)))
                   (pop keys)))
-        (var (mapconcat #'identity keys ".")))
+        (var (string-join keys ".")))
     (when (magit-get var)
       (magit-call-git "config" arg "--unset-all" var))
     (dolist (v values)
@@ -2425,15 +2425,14 @@ and this option only controls what face is used.")
                  0 (length target) 'magit-branch-upstream nil target)
                 (setq upstream target)
                 (setq combined (delete target combined))))))
-        (mapconcat #'identity
-                   (flatten-tree `(,state
-                                   ,head
-                                   ,upstream
-                                   ,@(nreverse tags)
-                                   ,@(nreverse combined)
-                                   ,@(nreverse remotes)
-                                   ,@other))
-                   " ")))))
+        (string-join (flatten-tree `(,state
+                                     ,head
+                                     ,upstream
+                                     ,@(nreverse tags)
+                                     ,@(nreverse combined)
+                                     ,@(nreverse remotes)
+                                     ,@other))
+                     " ")))))
 
 (defun magit-object-type (object)
   (magit-git-string "cat-file" "-t" object))
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index 6e9dcb0d7e..ee65bdce2e 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -1156,11 +1156,11 @@ Type \\[magit-reset] to reset `HEAD' to the commit at 
point.
 (defun magit-log-header-line-sentence (revs args files)
   "Return string containing all arguments."
   (concat "Commits in "
-          (mapconcat #'identity revs " ")
+          (string-join revs " ")
           (and (member "--reverse" args)
                " in reverse")
           (and files (concat " touching "
-                             (mapconcat #'identity files " ")))
+                             (string-join files " ")))
           (--some (and (string-prefix-p "-L" it)
                        (concat " " it))
                   args)))
diff --git a/lisp/magit-merge.el b/lisp/magit-merge.el
index d6b0198c38..3f41cc4355 100644
--- a/lisp/magit-merge.el
+++ b/lisp/magit-merge.el
@@ -302,7 +302,7 @@ If no merge is in progress, do nothing."
            (range (magit--merge-range (car heads))))
       (magit-insert-section (unmerged range)
         (magit-insert-heading
-          (format "Merging %s:" (mapconcat #'identity heads ", ")))
+          (format "Merging %s:" (string-join heads ", ")))
         (magit--insert-log nil
           range
           (let ((args magit-buffer-log-args))
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index 3f3a394b15..1368231935 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -516,7 +516,7 @@ and still alive), as well as the respective Magit status 
buffer.
 
 See `magit-start-process' for more information."
   (message "Running %s %s" (magit-git-executable)
-           (let ((m (mapconcat #'identity (flatten-tree args) " ")))
+           (let ((m (string-join (flatten-tree args) " ")))
              (remove-list-of-text-properties 0 (length m) '(face) m)
              m))
   (magit-start-git nil args))
@@ -717,7 +717,7 @@ Magit status buffer."
        " "
        (propertize (magit--ellipsis)
                    'font-lock-face 'magit-section-heading
-                   'help-echo (mapconcat #'identity (seq-take args global) " 
"))
+                   'help-echo (string-join (seq-take args global) " "))
        " "
        (propertize (mapconcat #'shell-quote-argument (seq-drop args global) " 
")
                    'font-lock-face 'magit-section-heading))))
@@ -1284,7 +1284,7 @@ Limited by `magit-process-error-tooltip-max-lines'."
       (let ((inhibit-message t))
         (when heading
           (setq lines (cons heading lines)))
-        (message (mapconcat #'identity lines "\n"))))))
+        (message (string-join lines "\n"))))))
 
 ;;; _
 (provide 'magit-process)
diff --git a/lisp/magit-reflog.el b/lisp/magit-reflog.el
index bb5cddbe0b..ef9d9b2ecb 100644
--- a/lisp/magit-reflog.el
+++ b/lisp/magit-reflog.el
@@ -196,9 +196,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
                   command))
          (text (if (string= command "commit")
                    label
-                 (mapconcat #'identity
-                            (delq nil (list command option type))
-                            " "))))
+                 (string-join (delq nil (list command option type)) " "))))
     (format "%-16s "
             (magit--propertize-face
              text (or (cdr (assoc label magit-reflog-labels))
diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index ee6b1e9a85..6a97319afc 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -309,7 +309,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point.
     (setq magit-refs-show-commit-count nil))
   (magit-set-header-line-format
    (format "%s %s" magit-buffer-upstream
-           (mapconcat #'identity magit-buffer-arguments " ")))
+           (string-join magit-buffer-arguments " ")))
   (magit-insert-section (branchbuf)
     (magit-run-section-hook 'magit-refs-sections-hook))
   (add-hook 'kill-buffer-hook #'magit-preserve-section-visibility-cache))
@@ -527,7 +527,7 @@ line is inserted at all."
     (magit-insert-section (branchdesc branch t)
       (magit-insert-heading branch ": " (car desc))
       (when (cdr desc)
-        (insert (mapconcat #'identity (cdr desc) "\n"))
+        (insert (string-join (cdr desc) "\n"))
         (insert "\n\n")))))
 
 (defun magit-insert-tags ()
diff --git a/lisp/magit-status.el b/lisp/magit-status.el
index b2de4d9113..438c27df71 100644
--- a/lisp/magit-status.el
+++ b/lisp/magit-status.el
@@ -530,7 +530,7 @@ the status buffer causes this section to disappear again."
         (when magit-buffer-diff-files
           (insert " -- ")))
       (when magit-buffer-diff-files
-        (insert (mapconcat #'identity magit-buffer-diff-files " ")))
+        (insert (string-join magit-buffer-diff-files " ")))
       (insert ?\n))))
 
 ;;;; Reference Headers
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index a6b7704795..9ee9f5839d 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -408,7 +408,7 @@ to recover from making a mistake here, but don't count on 
it."
         (if (cdr modified)
             (message "Omitting %s modules with uncommitted changes: %s"
                      (length modified)
-                     (mapconcat #'identity modified ", "))
+                     (string-join modified ", "))
           (message "Omitting module %s, it has uncommitted changes"
                    (car modified)))
         (setq modules (cl-set-difference modules modified :test #'equal))))
diff --git a/test/magit-tests.el b/test/magit-tests.el
index 4e0027cf34..310a3b1cbf 100644
--- a/test/magit-tests.el
+++ b/test/magit-tests.el
@@ -68,7 +68,7 @@
                  (push (buffer-substring-no-properties (point) to) chunks))
                (goto-char to)
                (< (point) (point-max))))
-      (let ((result (mapconcat #'identity (nreverse chunks) nil)))
+      (let ((result (string-join (nreverse chunks))))
         (unless raw
           (setq result (string-trim result)))
         result))))

Reply via email to