Function: hibtypes-git-find

hibtypes-git-find is a byte-compiled function defined in hib-social.el.

Signature

(hibtypes-git-find FILE)

Documentation

Return the shortest pathname matching git-versioned FILE name.

Search for matches in this order: (1) the git repository of the current directory, if any; (2) the git repository of project hibtypes-git-default-project if not nil; (3) the list of locally cached git repositories in hibtypes-git-repos-cache.

Return nil if no match is found.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hib-social.el
(defun hibtypes-git-find (file)
  "Return the shortest pathname matching git-versioned FILE name.

Search for matches in this order: (1) the git repository of the
current directory, if any; (2) the git repository of project
`hibtypes-git-default-project' if not nil; (3) the list of
locally cached git repositories in `hibtypes-git-repos-cache'.

Return nil if no match is found."
  (let (root)
    (cond
     ;; Try to find in current directory tree first...
     ((and (setq root (locate-dominating-file default-directory ".git"))
	   (hibtypes-git-find-execute "find" root file)))
     ;; then in default project tree...
     ((and hibtypes-git-default-project
	   (setq root (hibtypes-git-project-directory hibtypes-git-default-project))
	   (hibtypes-git-find-execute "find" root file)))
     ;; then in any of list of cached project trees...
     ((or (and (file-readable-p hibtypes-git-repos-cache)
	       (not (zerop (nth 7 (file-attributes hibtypes-git-repos-cache))))) ; Non-zero file size
	  (hibtypes-git-build-repos-cache t))
      (hibtypes-git-find-execute (format "cat '%s' | xargs -I{} find" hibtypes-git-repos-cache)
				 "'{}'"
				 file))
     ;; otherwise, fail.
     (t (message "") ; Clear any potential message from building the cache.
	nil))))