Skip to content

Gracefully handle empty repositories #191

@rgmz

Description

@rgmz

Is your feature request related to a problem? Please describe.
When analyze_org or analyze_repo is run against an empty repository, the clone will fail and an error will be printed.

./poutine analyze_org my-org --token="..."
Analyzing repositories  23% |█████████                               | (128/542) [2m33s:6m45s]
11:00AM | ERROR | failed to clone repo error="failed to clone repo: command `/usr/local/bin/git fetch --quiet --no-tags --depth 1 --filter=blob:none origin HEAD` returned an error: exit status 128 stderr: fatal: couldn't find remote ref HEAD" repo=my-org/empty_repo

Describe the solution you'd like

Since empty repos should be a "known" issue, it should print a message to the effect of "skipping empty repo", rather than a vague error.

Possible solutions:

  1. Update the Repository interface to include GetSize(). Then, when iterating repositories any ones with a size of 0 (i.e., empty) can be skipped. This assumes that every current and future provider, uh, provides the repository size in the API.
  2. Update the client logic for each provider to filter empty repositories before sending them to the channel, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions