Skip to content

setuptools_scm silently reports garbage version with partial Git clone #790

@paugier

Description

@paugier

Readthedocs clones with

git clone --no-single-branch --depth 50 https://github.com/snek5000/snek5000.git
cd snek5000
git checkout --force origin/main
git clean -d -f -f

With such clone,

$ git --git-dir .git describe --dirty --tags --long
fatal: No tags can describe '2a7b9f0b372163f19d0af2dc1cb6752528310530'.
Try --always, or create some tags.

In contrast, git tag gives the right list of tags. Anyway, setuptools_scm bases its analysis on git describe so it gives a wrong version (something like 0.1.dev173+g2a7b9f0).

To get the right version, I need to run:

$ git pull --unshallow
remote: Enumerating objects: 298, done.
remote: Counting objects: 100% (267/267), done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 169 (delta 102), reused 138 (delta 78), pack-reused 0
Receiving objects: 100% (169/169), 23.59 KiB | 23.59 MiB/s, done.
Resolving deltas: 100% (102/102), completed with 22 local objects.
Already up to date.

$ git --git-dir .git describe --dirty --tags --long
0.8.0rc0-285-g2a7b9f0

I don't know what setuptools_scm could do about this case, but it is annoying. Maybe at least a warning?

CC @ashwinvis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions