Skip to content

Support of tag in revision with shallow clone #107

@Esteves4

Description

@Esteves4

Hello,
I would like to request the support of using tag names when doing a shallow clone.

If I understood correctly, when shallow clone is used with a revision it will run:

elif depth and revision:
            self.path.mkdir(parents=True)
            self._run(("init",), capture_output=True)
            self._run(("remote", "add", "origin", str(url)))
            self._run(("fetch", "--depth", str(depth), "origin", revision), capture_output=True)
if revision:
            self._run(("checkout", revision), capture_output=True)

But if revision is a tag, the checkout will fail:
error: pathspec '<tag>' did not match any file(s) known to git

I did some digging, and knowing that the revision is a tag, the git fetch could be executed as:
git fetch --depth 1 origin tag <tag>

Which makes the checkout work properly.

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