Skip to content

skip 'git describe' call unless .git exists #1

@warner

Description

@warner

https://bugzilla.mozilla.org/show_bug.cgi?id=718115 (which is about a copy of Versioneer that I put into Jetpack) is about a leaked error message that occurs when the version-determining code tries to run git describe in a tree that has no .git directory. (In jetpack's case, this is because we have a git-to-mercurial bridge to support some legacy test automation, so they're running code that comes from an hg checkout, which of course has no .git directory).

The version-checking code correctly resolves version="unknown", but emits a scary "fatal: Not a git repository" message to stderr in the process.

The fix is to do an extra os.path.isdir(".git") check before calling git describe, and return None if .git is not present.

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