Function: bazel--repository-root

bazel--repository-root is a natively compiled function defined in bazel.el.

Signature

(bazel--repository-root FILE-NAME)

Documentation

Find the root of the Bazel repository containing FILE-NAME.

If FILE-NAME is not in a Bazel repository, return nil. Otherwise, the return value is a directory name. FILE-NAME can be a file or directory name.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
;;;; Utility functions to work with Bazel repositories

(defun bazel--repository-root (file-name)
  "Find the root of the Bazel repository containing FILE-NAME.
If FILE-NAME is not in a Bazel repository, return nil.  Otherwise,
the return value is a directory name.  FILE-NAME can be a file or
directory name."
  (declare (ftype (function (string) (or string null))))
  (cl-check-type file-name string)
  (when-let* ((result (locate-dominating-file file-name
                                              #'bazel--repository-root-p)))
    (file-name-as-directory result)))