Skip to content

Commit

Permalink
patch bug go-git/go-git#305 object not found when trying to pull a re…
Browse files Browse the repository at this point in the history
…pository cloned with Depth: 1 #305
  • Loading branch information
rotty3000 committed Sep 29, 2022
1 parent 168a3d2 commit ec47296
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions patches/issues-305.patch
@@ -0,0 +1,30 @@
From d29b60df7c069d6341e40ff205e0caebbaeb1bb4 Mon Sep 17 00:00:00 2001
From: Raymond Augé <raymond.auge@liferay.com>
Date: Thu, 29 Sep 2022 13:48:50 -0400
Subject: object not found when trying to pull a repository cloned with Depth:
1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

fixes #305

Signed-off-by: Raymond Augé <raymond.auge@liferay.com>

diff --git a/remote.go b/remote.go
index db78ae7..00f0050 100644
--- a/remote.go
+++ b/remote.go
@@ -1060,6 +1060,12 @@ func isFastForward(s storer.EncodedObjectStorer, old, new plumbing.Hash) (bool,
found = true
return storer.ErrStop
})
+
+ // Shallow clones may lead to a commit where the parent is absent
+ // resulting in plumbing.ErrObjectNotFound.
+ if err == plumbing.ErrObjectNotFound {
+ return found, nil
+ }
return found, err
}

6 changes: 6 additions & 0 deletions vendor/github.com/go-git/go-git/v5/remote.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ec47296

Please sign in to comment.