src-d / go-git

Project has been moved to: https://github.com/go-git/go-git
https://github.com/go-git/go-git
Apache License 2.0
4.91k stars 542 forks source link

Fix an edge case when fetching remotes with unrelated incomplete history. Fixes #1151 #1152

Open NonLogicalDev opened 5 years ago

NonLogicalDev commented 5 years ago

In getHaves, allow the getHavesRef to fail with object not found when iterating over incomplete history, and don't treat it as a fatal error.

It might also worth to revise the object.NewCommitPreorderIter logic, to perhaps not fail once reachable commits are exhausted.

Fixes #1151

mcuadros commented 5 years ago

How behaves git?

NonLogicalDev commented 5 years ago

It does not error out when attempting to fetch on a shallowly cloned repository. Just checked:

git init
git remote add repo1 <url1>
git fetch repo1 --depth 1
git remote add repo2 <url2>
git fetch repo2 --depth 1 // this works in git, but equivalent fails in `go-git`

In the same situation go-git catches an error object not found when enumerating wants

NonLogicalDev commented 4 years ago

@mcuadros Any update on this?