remote.fetch depth= parameter broken with anonymous remotes

Open
#1,314 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
git, python
Domain
tooling

Research direction

Start by running the reproduction using pygit2.Repository, init_repository, create_anonymous, and remote.fetch(depth=1, refspecs=...) against the file remote. Inspect the fetch path handling anonymous remotes and verify the result with git log v1.15.1 in the destination repository; done means the fetched tag contains only the requested shallow history.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libgit2/pygit2

All issues in libgit2/pygit2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.