2

I have a 3rd party dependency in may code, call it repo A. The dependency itself has a git submodule, call the submodule repo B. Sometime in the last couple months, someone must have rebased repo B because the commit referenced in repo A no longer exists in repo B, and when I try to recursively clone repo A, I get the following error:

fatal: reference is not a tree: 3c27a70ae7304feb48c60b268c70adf585879d50
Unable to checkout '3c27a70ae7304feb48c60b268c70adf585879d50' in submodule path 'B'

However, when I navigate in a browser to https://github.com/A, there is a link to the submodule in the repo overview. If I click the link to the submodule dependency, and I get taken to this page: https://github.com/B/tree/3c27a70ae7304feb48c60b268c70adf585879d50

In the upper left I see this: enter image description here

This image, together with the URL tree/3c27a70ae7304feb48c60b268c70adf585879d50, has me confused. Looking here leads me to believe that the commit still exists but just hasn't been 'garbage-collected' by github.

My questions are:

1) What exactly is this "tree" object, since it is not a branch, and the SHA does not appear to reference any git object?

2) Is it possible to recover the commit referenced in the github page?

3) I'm assuming the answer to (2) is no, in which case, does that mean my dependency is just broken? (Note: I am aware that I can look for the same commit in repo B and then just "manually" add in the submodule dependency for repo A, however this introduces its own set of issues that I'd prefer to avoid if possible.)

  • 1
    You're right: it's a link to a commit that has not been GC-ed. The short answers are (1) it's a commit, but you can't get it; (2) no; (3) yes. – torek Jan 23 '18 at 19:56
  • 2
    @torek Thanks, those were then answers I expected but didn't want to hear :) – ChocolateAndCheese Jan 23 '18 at 20:02
  • @torek is there any chance you could write an answer with a bit more explanation? Or link to another which does? – evolutionxbox Jan 23 '18 at 22:20
  • 1
    @evolutionxbox: it's a bit tricky to make good examples. If you push a commit to a GitHub repo, then get a link to it and save the link somewhere, then force-push to the same repo so that the commit is no longer at the tip of whatever branch, you can still view the commit via the saved link ... up until GitHub GCs the commit. If you fork the repo, Git can't GC the commit until they migrate the object to the other fork. But *when is that?* We have no control; it's up to GitHub. If we build an example and post it as an answer, the link eventually dies and the answer is now out of date. – torek Jan 23 '18 at 22:30
  • Note that if you have access to the fork that still has the commit "live", you could get it from that (different) repo on GitHub, or any clone thereof. But again this gets pretty tricky, and we're depending on GitHub internals that they are free to change in the future. – torek Jan 23 '18 at 22:32

0 Answers0