-
Notifications
You must be signed in to change notification settings - Fork 787
object not found
when trying to pull a repository cloned with Depth: 1
#305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
object not found
when trying to pull a repository cloned with depth: 1object not found
when trying to pull a repository cloned with Depth: 1
@jfontan @mcarmonaa any idea? |
TL;DR - Use I ran into similar problems recently. Initially I worked around the shallow fetch issue by doing a full fetch. The fetch was actually fast, but then the push itself was taking 10 seconds. Weird... So I ended up spending more time trying to understand what was going wrong. Unfortunately I'm not familiar enough with the code base to fix the actual issue, but hopefully my brain dump helps for people to locate the issue, or at least provides useful clues how to work around it: Without further ado, here are my findings: For local urls, the code in
The first issue I ran into when doing a shallow fetch and then a push is I think what you run into as well. The first However when including ".git" in the path url, I ran into the next issue: The first call to So then I realized I could bypass the "local url" logic by providing the repository in the |
@wyarde thank you so much for posting your findings! I’m going to try this when I’m home- thank you so much |
I hope that the maintainers can fix this bug with this information. |
@wyarde, I tried opening the repository with r, err := git.PlainOpen(repo.Path) |
What does your file path look like? |
(If not on windows, you would still need to use forward slashes, but I guess it's more intuitive then) |
same issue here, the code I use is exactly the plain clone code the issue author mentioned except for the gitURL which is “https://github.com/rime/rime-cantonese” and here’re the things I found so far. the commit treeobject got from getTreeFromCommitHash in worktree.Reset() is still good, you can print the names etc. but when getting the actual file with t.File in checkoutChangeRegularFile, the file blob can’t have a Reader(). eg in plumbing/object/object.go. the blob obj is actually a plumbing.EncodedObject. And then I lost my direction because EncodedObject is an interface, there are so many ways in go-git to create one. BTW, the file in trouble in my previous git url is “jyut6ping3.dict.yaml” and the commit in trouble is “ 1168d4ca475656748938475ca5d96e41096d8b5a“. Hope this helps for who interested in further debugging. For now I have to add a “use-system-git” option for my app...sad |
aha...sorry for my example, you can’t even plain clone https://github.com/rime/rime-cantonese |
@jfontan @mcarmonaa any idea? |
So sorry @wyarde I completely forgot and have been really, really busy. My file path is just |
@stingalleman is this on windows? You need to include the drive letter as in my example |
@wyarde No, I am on a MacOS system. |
@stingalleman sorry cannot help you there |
I'm getting |
A colleague and I have solved this issue. The iterator used in the fastforward check wasn't prepared for the case when a commit might have a missing parent (as in shallow clones). Handling that case solved the problem of pulling on shallow clones. |
…pository cloned with Depth: 1 #305
I think I've actually found a better solution to this problem. It seems that the concept of This iteration should check if @@ -691,6 +691,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 |
fixes go-git#305 Signed-off-by: Raymond Augé <raymond.auge@liferay.com>
Due to go-git issue #305 (go-git/go-git#305) - pulling on shallow clone leads to object not found error.
Due to go-git issue #305 (go-git/go-git#305) - pulling on shallow clone leads to object not found error.
git: Fix fetching after shallow clone. Fixes #305
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
Hey! I was wondering when we may expect this to be released? I have a few changes that are ready to make use of this change and would be interested to know the timeline. |
@williambanfield I am not sure when the next release will happen, but it will probably be by the end of this month. If you need the changes sooner, use the pseudo-version instead:
|
Is this fix actually working for anyone? Because even with v5.8.1 I'm getting the same |
@jmriebold this bug was about pulling/fetching, if you are having issues with pushing then please see if there is another issue with that bug or open a new one. |
Sorry, what I mean is that I still get |
@AriehSchneier do you have any suggestions? If not I think this issue should be reopened. |
@jmriebold are you able to write a test, or tell us the steps to be able to reproduce it? |
@AriehSchneier ill put together something that can just be checked out and run but i can reproduce with the following.
I have been using this simple repo to reproduce https://github.com/stvnksslr/sandbox-git here is a gist with modifications to the example pull https://gist.github.com/stvnksslr/589c029055b40b3e2736482e90fc784a edit: made reproduction steps a little more clear. |
Ohh, you are trying to change the depth (unshallow), that is probably being tracked in #328 |
@AriehSchneier Thank you for responding! I really appreciate you helping us get to the root of this issue. To be clear I dont think this is related to unshallowing, its a cloned repo with a depth of 1 and a pull with a depth of 1 returning "object not found" when a change is made in the repo and the pull is initiated. created a repo that should reproduce the issue end to end fairly easily https://github.com/stvnksslr/sandbox-go-git build the project substitute the repository for one you are able to make changes too
|
@pjbgf @AriehSchneier Apologize for the tag, the steps for reproducing this issue seem straight forward unsure as to why it wouldn't show up in the tests. let me know if there is anything else I can do to help with any of the leg work for this issue. Additionally I can confirm the issue is not present with the same code example if the depth flags are removed from both the clone and the pull. |
Got really excited about #932, updated dependency to use this...but still encountering the git pull problem. Any workarounds and also ideas on where this is happening? |
+1 from me- the behavior that i'm running into is:
|
git: stop iterating at oldest shallow when pulling. Fixes #305
Signed-off-by: Arieh Schneier <15041913+AriehSchneier@users.noreply.github.com>
…low-v2 git: Fix fetching after shallow clone. Fixes go-git#305
git: stop iterating at oldest shallow when pulling. Fixes go-git#305
Hi,
When you clone a repository with
Depth: 1
, you cannot pull it. It'll error withobject not found
.Cloning:
Pulling:
It's critical that I can pull with Depth: 1, because the repository I'm pulling might be very large (hundreds of thousands of commits). Can somebody take a look at this?
The text was updated successfully, but these errors were encountered: