Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch bug go-git/go-git#305 object not found when trying to pull a re…
…pository cloned with Depth: 1 #305
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.