Function: projectile--git-status-changed-files

projectile--git-status-changed-files is a byte-compiled function defined in projectile.el.

Signature

(projectile--git-status-changed-files ROOT)

Documentation

Return the paths git reports as changed in ROOT's working tree.

Covers staged, unstaged and untracked files, as repository-relative paths. A rename occupies two NUL-separated fields - the new name and then the old one - so those are consumed in step rather than the old name being mistaken for another changed file.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--git-status-changed-files (root)
  "Return the paths git reports as changed in ROOT\\='s working tree.
Covers staged, unstaged and untracked files, as repository-relative
paths.  A rename occupies two NUL-separated fields - the new name and
then the old one - so those are consumed in step rather than the old
name being mistaken for another changed file."
  (when-let* ((output (projectile--git root "status" "--porcelain" "-z"
                                       "--untracked-files=all")))
    (let ((records (split-string output "\0" t))
          files)
      (while records
        (let ((record (pop records)))
          ;; "XY PATH", with X and Y the index and worktree status codes.
          (when (> (length record) 3)
            (let ((status (substring record 0 2))
                  (path (substring record 3)))
              (push path files)
              ;; A rename or copy carries the source path in the next field.
              (when (string-match-p "[RC]" status)
                (pop records))))))
      (nreverse files))))