sds/overcommit · error · Overcommit::Exceptions::Error

Error listing files. EXIT STATUS(es): #{result.statuses}. ST

Error message

Error listing files. EXIT STATUS(es): #{result.statuses}.
STDOUT(s): #{result.stdouts}.
STDERR(s): #{result.stderrs}.

What it means

Error "Error listing files. EXIT STATUS(es): #{result.statuses}. STDOUT(s): #{result.stdouts}. STDERR(s): #{result.stderrs}." thrown in sds/overcommit.

Source

Thrown at lib/overcommit/git_repo.rb:115

      `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.
        split("\0").
        map(&:strip).
        reject(&:empty?).
        map { |relative_file| File.expand_path(relative_file) }
    end

    # Returns the names of files in the given paths that are tracked by git.
    #
    # @param paths [Array<String>] list of paths to check
    # @option options [String] ref ('HEAD') Git ref to check
    # @return [Array<String>] list of absolute file paths
    def list_files(paths = [], options = {})
      ref = options[:ref] || 'HEAD'

      result = Overcommit::Utils.execute(%W[git ls-tree --name-only #{ref}], args: paths)
      unless result.success?
        raise Overcommit::Exceptions::Error,
              "Error listing files. EXIT STATUS(es): #{result.statuses}.\n" \
              "STDOUT(s): #{result.stdouts}.\n" \
              "STDERR(s): #{result.stderrs}."
      end

      result.stdout.split(/\n/).
        map { |relative_file| File.expand_path(relative_file) }.
        reject { |file| File.directory?(file) } # Exclude submodule directories
    end

    # Returns whether the specified file/path is tracked by this repository.
    #
    # @param path [String]
    # @return [true,false]
    def tracked?(path)
      Overcommit::Utils.execute(%W[git ls-files #{path} --error-unmatch]).success?
    end

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Inspect the printed exit statuses and stderr from the `git ls-tree` invocations to find the underlying failure (bad ref, missing object, corrupt repo).
  2. Ensure the referenced git ref exists (default HEAD); on a repo with no commits this call fails until an initial commit is made.
  3. Verify the repository is healthy with `git fsck` and that git works on the PATH.

When it happens

Trigger: Thrown at lib/overcommit/git_repo.rb:115 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sds/overcommit@fee0cd74b2 (2026-08-23). Data as JSON: /api/errors/1d1a5c30b37186fc. Report an issue: GitHub.