emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit fc9bf407ab 2/4: magit-clone: Add hook `magit-po


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit fc9bf407ab 2/4: magit-clone: Add hook `magit-post-clone-hook'
Date: Mon, 6 Feb 2023 06:59:03 -0500 (EST)

branch: elpa/git-commit
commit fc9bf407aba6d28a5513856e7f3b056ee0288890
Author: Nacho Barrientos <nacho.barrientos@cern.ch>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-clone: Add hook `magit-post-clone-hook'
---
 docs/magit.org      |  6 ++++++
 docs/magit.texi     |  6 ++++++
 lisp/magit-clone.el | 11 +++++++++++
 3 files changed, 23 insertions(+)

diff --git a/docs/magit.org b/docs/magit.org
index 2da134a26f..87cdb237eb 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -4354,6 +4354,12 @@ The following suffixes are disabled by default. See
             (nil . "git@%h:%n.git")))
   #+END_SRC
 
+- User Option: magit-post-clone-hook ::
+
+  Hook run after the Git process has successfully finished cloning the
+  repository.  When the hook is called, ~default-directory~ is
+  let-bound to the directory where the repository has been cloned.
+
 ** Staging and Unstaging
 
 Like Git, Magit can of course stage and unstage complete files.
diff --git a/docs/magit.texi b/docs/magit.texi
index bcbb455b84..83a24b993f 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -5410,6 +5410,12 @@ Example of by-hostname format strings:
 @end lisp
 @end defopt
 
+@defopt magit-post-clone-hook
+Hook run after the Git process has successfully finished cloning the
+repository.  When the hook is called, @code{default-directory} is
+let-bound to the directory where the repository has been cloned.
+@end defopt
+
 @node Staging and Unstaging
 @section Staging and Unstaging
 
diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el
index 37e2312a83..22be7f7f1f 100644
--- a/lisp/magit-clone.el
+++ b/lisp/magit-clone.el
@@ -112,6 +112,15 @@ default.  Also see `magit-clone-name-alist'."
                                           (const :tag "Default" t))
                         :value-type (string :tag "Format"))))
 
+(defcustom magit-post-clone-hook nil
+  "Hook run after the repository has been successfully cloned.
+
+When the hook is called, `default-directory' is let-bound to the
+directory where the repository has been cloned."
+  :package-version '(magit . "3.4.0")
+  :group 'magit-commands
+  :type 'hook)
+
 ;;; Commands
 
 ;;;###autoload (autoload 'magit-clone "magit-clone" nil t)
@@ -275,6 +284,8 @@ Then show the status buffer for the new repository."
            (let ((default-directory directory))
              (magit-call-git "sparse-checkout" "init" "--cone")
              (magit-call-git "checkout" (magit-get-current-branch))))
+         (let ((default-directory directory))
+           (run-hooks 'magit-post-clone-hook))
          (with-current-buffer (process-get process 'command-buf)
            (magit-status-setup-buffer directory)))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]