Skip to content

Commit

Permalink
object not found when trying to pull a repository cloned with Depth: 1
Browse files Browse the repository at this point in the history
fixes go-git#305

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
  • Loading branch information
rotty3000 committed Mar 7, 2023
1 parent 8557a36 commit fdef84b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,15 @@ func getHavesFromRef(
toVisit := maxHavesToVisitPerRef
return walker.ForEach(func(c *object.Commit) error {
haves[c.Hash] = true

if s, _ := s.Shallow(); len(s) > 0 {
for _, sh := range s {
if sh == c.Hash {
return storer.ErrStop
}
}
}

toVisit--
// If toVisit starts out at 0 (indicating there is no
// max), then it will be negative here and we won't stop
Expand Down

0 comments on commit fdef84b

Please sign in to comment.