Function: vc-add-working-tree
vc-add-working-tree is an autoloaded, interactive and byte-compiled
function defined in vc.el.gz.
Signature
(vc-add-working-tree BACKEND DIRECTORY)
Documentation
Create working tree DIRECTORY with same backing repository as this tree.
Must be called from within an existing VC working tree. When called interactively, prompts for DIRECTORY. When called from Lisp, BACKEND is the VC backend.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-add-working-tree (backend directory)
"Create working tree DIRECTORY with same backing repository as this tree.
Must be called from within an existing VC working tree.
When called interactively, prompts for DIRECTORY.
When called from Lisp, BACKEND is the VC backend."
(interactive
(list
(vc-responsible-backend default-directory)
(read-directory-name "Location for new working tree: "
(file-name-parent-directory
(or (vc-root-dir)
(error "File is not under version control"))))))
(vc-call-backend backend 'add-working-tree directory)
;; `vc-switch-working-tree' relies on project.el registration so try
;; to ensure that both the old and new working trees are registered.
;; `project-current' should not return nil in either case, but don't
;; signal an error if it does.
(when-let* ((p (project-current)))
(project-remember-project p nil t))
(when-let* ((p (project-current nil directory)))
(project-remember-project p))
(dired directory))