pygit2
pygit2 copied to clipboard
remote.fetch depth= parameter broken with anonymous remotes
import os
import pygit2
source = pygit2.Repository("pygit2")
dest = pygit2.init_repository("dest", bare=True)
remote = dest.remotes.create_anonymous(f'file://{os.path.abspath("pygit2")}')
remote.fetch(depth=1, refspecs=[f"refs/tags/v1.15.1:refs/tags/v1.15.1"])
# now if you 'git log v1.15.1' in ./dest you'll see many commits, not just one
ping @nikitalita
Thanks.
Might be due to this? https://github.com/libgit2/pygit2/pull/1245
Note: The test for the shallow clone is currently online only due to libgit2 only supporting shallow clones of remote repositories. The git cli allows you to shallow clone a local repository if you use a file URI, but it seems that libgit2 doesn't support that.
Thanks for looking. Seems plausible that it's that.
Sean Whitton