1

So I'm participating in this project, using git.

There's a bunch of source files and some libraries we refer to. The libs are put into git as sub-modules (e.g. BulletPhysics) and shall not be altered by our team.

According to Murphy's law, this alteration has happened, along with a commit/push, which seemed not to have had any effect...

... Until some guy lost his local repo and had to re-clone. Well, all that happens is some part of the project being actually downloaded, but when it comes to bullet, all that happens is

Unable to checkout 'cc1b481c8ec2868595db30303d88bd12bc1bcf2a' in submodule path 'extern/bullet'

Our supervisor told us it has been broken by the commit/push action(s) that tried to alter bullet, with us not having rights to do this, and that he doesn't know how to fix this.

Could anybody help me fix this without judging him? ;)

regards, LDer

8
  • You should check the submodules of the cloned repository. Do the submodule repositories exist at the specified locations in .gitmodules? And do the referenced commits exist in those repositories, namely cc1b481c8ec2868595db30303d88bd12bc1bcf2a in the repository for extern/bullet?
    – Koraktor
    Dec 19, 2012 at 15:28
  • How should I check this? in my local working copy or by ssh-ing into the git server?
    – LDericher
    Dec 19, 2012 at 15:30
  • The .gitmodules file should be present in your local clone (and the remote one).
    – Koraktor
    Dec 19, 2012 at 15:37
  • The {.gitmodules} file exists in both my local copy and the remote repo, although i cant find any references to the specified commit. I looked through the .git/objects for that
    – LDericher
    Dec 19, 2012 at 16:41
  • I found the invalid commits to extern/bullet. They are id'ed by 89301e760119f40ef2077c2f41b09046b66f70fd, dcabd79df2a73661cd101000b5bbd63a76cdf81b and ee082ffc4ac537bf141ee2562e0d79a9612eb8b1. Is there a way to reroll these commits with only touching extern/bullet?
    – LDericher
    Dec 19, 2012 at 16:46

1 Answer 1

0

I found the solution:

(Several sources around the web, combined. Feel free to add your own comment.)

first, go to submodule folder in terminal. In my case, /path/to/.../project/extern/bullet. Execute the following commands there

cd /path/to/.../project/extern/bullet

Using 'git log', find the sha-id of the last valid commit. In my case, the one before "cc1b481c8ec2868595db30303d88bd12bc1bcf2a". As you might guess, it was "c2720237e96e126dddb37f0496242d3adbf31ab0". This is what should fix it:

git reset --hard c2720237e96e126dddb37f0496242d3adbf31ab0
git submodule init
git submodule update
cd /path/to/.../project
git add extern/bullet
git commit
git push

Until now, the repo works as expected.

Best regards, LDericher

2
  • What do you mean by "valid" commit? Did cc1b481c8ec2868595db30303d88bd12bc1bcf2a exist? If so, you should check your repository (and maybe file system) for corruption (see git-fsck).
    – Koraktor
    Dec 19, 2012 at 18:55
  • The last "valid" commit is the last one before cc1b481c8ec2868595db30303d88bd12bc1bcf2a, which only existed in the git log under extern/bullet. This cc1b...-commit did cause the error in question. 'git fsck' did find some errors, though. "Dangling blobs/commits/trees" and sha-checksums for them. None of them notorious checksums in there, while the "dangling" generally is a bit unsettling.
    – LDericher
    Dec 19, 2012 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.