Skip to content

$gitShortSha() returns git error message as version string when not in a git repo #2671

Description

@zainforbjs

Describe the bug
When running wheels deploy from a directory that is not a git repository, the version string becomes "fatal: not a git repository (or any of the parent directories): .git" instead of a short SHA. The $gitShortSha() method merges stderr into stdout via redirectErrorStream(true) and reads the output without checking the git process exit code.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new app directory without git:
wheels new testapp && cd testapp
  1. Run wheels deploy init and configure deploy.yml.
  2. Run wheels deploy.
  3. See output: Deployed testapp version fatal: not a git repository (or any of the parent directories): .git to 1 host(s): ...

Expected behavior
When not in a git repo, the version should gracefully fall back to "unknown" (or similar). The deploy should not fail or produce a broken version string.

Desktop

  • OS: macOS

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