Function: majutsu-workspace--root-for-name

majutsu-workspace--root-for-name is a natively compiled function defined in majutsu-workspace.el.

Signature

(majutsu-workspace--root-for-name NAME)

Documentation

Return the workspace root directory for NAME, or nil.

This calls jj workspace root --name NAME (available since jj v0.38.0) and returns a directory name with a trailing slash. Only the one newline written by jj is removed; embedded or trailing newlines belonging to the actual path are preserved.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-workspace.el
(defun majutsu-workspace--root-for-name (name)
  "Return the workspace root directory for NAME, or nil.

This calls `jj workspace root --name NAME' (available since jj v0.38.0)
and returns a directory name with a trailing slash.  Only the one newline
written by jj is removed; embedded or trailing newlines belonging to the
actual path are preserved."
  (let ((output (or (majutsu-jj-buffer-string
                     "workspace" "root" "--name" name)
                    "")))
    (when (string-suffix-p "\n" output)
      (setq output (substring output 0 -1)))
    (when (not (string-empty-p output))
      (majutsu-jj-expand-directory-from-jj output default-directory))))