gitpython-developers / gitdb

IO of git-style object databases
http://gitdb.readthedocs.org
Other
212 stars 65 forks source link

Use actions/checkout feature to fetch all commits #92

Closed EliahKagan closed 10 months ago

EliahKagan commented 10 months ago

It appears the intent of specifying a fetch-depth of 1000 is that 1000 is greater enough than the current number of commits in the repository that it will fetch the whole branch history, now and for some time into the future.

Assuming that is the case, I recommend doing a full fetch instead, which this PR changes it to do. Setting the fetch-depth to a positive value fetches that many commits back (and the default value is 1), but setting it to 0 fetches all commits, as in a normal deep (full) fetch.

Byron commented 10 months ago

Thank you! I agree that setting it to zero is an indication that we need a couple of commits for tests to work. This reminds me of another glaring issue of GitPython: tests are not isolated and require a certain initial state that affects ones own work-environment. In practice, that's not an issue most of the time, but it's an issue nonetheless. In gitoxide tests are fully isolated and it's as easy as writing a bash script with git commands to setup a new fixture. Maybe one day, GitPython will have isolated/sandboxed tests as well.