git submodule update fails
uncovery opened this issue · 11 comments
it returns:
git submodule update
fatal: reference is not a tree: 6eb764fefcd1504d411647a5b23eb4b8f23c1756
Unable to checkout '6eb764fefcd1504d411647a5b23eb4b8f23c1756' in submodule path 'libs/unc'
Silly question: did you do 'git submodule init' first? When I do init then update it works for me.
yes,
[root@ c10t]# git submodule init
Submodule 'libs/unc' () registered for path 'libs/unc'
[root@ c10t]# git submodule update
fatal: reference is not a tree: 6eb764fefcd1504d411647a5b23eb4b8f23c1756
Unable to checkout '6eb764fefcd1504d411647a5b23eb4b8f23c1756' in submodule path 'libs/unc'
I was able to recreate your problem by removing my clone and creating a new one.
jmt@nala:~$ cd git
jmt@nala:~/git$ rm -rf c10t
jmt@nala:~/git$ git clone https://github.com/udoprog/c10t.git
Cloning into 'c10t'...
remote: Counting objects: 11792, done.
remote: Compressing objects: 100% (6529/6529), done.
remote: Total 11792 (delta 5372), reused 11540 (delta 5128)
Receiving objects: 100% (11792/11792), 9.35 MiB | 129 KiB/s, done.
Resolving deltas: 100% (5372/5372), done.
jmt@nala:~/git$ cd c10t
jmt@nala:~/git/c10t$ git submodule init
Submodule 'libs/unc' (git://github.com/udoprog/unc.git) registered for path 'libs/unc'
jmt@nala:~/git/c10t$ git submodule update
Cloning into 'libs/unc'...
remote: Counting objects: 109, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 109 (delta 48), reused 107 (delta 47)
Receiving objects: 100% (109/109), 1.31 MiB | 158 KiB/s, done.
Resolving deltas: 100% (48/48), done.
fatal: reference is not a tree: 6eb764fefcd1504d411647a5b23eb4b8f23c1756
Unable to checkout '6eb764fefcd1504d411647a5b23eb4b8f23c1756' in submodule path 'libs/unc'
jmt@nala:~/git/c10t$
I don't know how well git bisect works with this kind of problem. Hmm!
Ok, I now did a
git clone https://github.com/udoprog/unc.git
and copied the contents of the .git directory to
/c10t/.git/modules/libs/unc
cmake . works fine
However, I get this one on make:
[ 2%] Building CXX object src/nbt/CMakeFiles/c10t-nbt.dir/nbt.cpp.o
/home/minecraft/server/c10t/c10t/src/nbt/nbt.hpp: In function ‘void nbt::default_error_handler(C_, size_t, const char_)’:
/home/minecraft/server/c10t/c10t/src/nbt/nbt.hpp:248: error: ‘cerr’ is not a member of ‘std’
make[2]: *** [src/nbt/CMakeFiles/c10t-nbt.dir/nbt.cpp.o] Error 1
make[1]: *** [src/nbt/CMakeFiles/c10t-nbt.dir/all] Error 2
make: *** [all] Error 2
I think the right solution here is to figure out which git revision changed the unc submodule. git bisect can do that. Alternatively, one of the developers who actually did the change might speak up here? :-) Later this weekend I will at least identify the revision, and make a comment in the commit.
thanks! I am not really good at all of this. Your help is really appreciated.
Curiouser and curiouser.
I tried to use git bisect and it didn't do any good.
I then traversed the project in github and saw that the link hadn't changed in like four months or something.
https://github.com/udoprog/unc/tree/6eb764fefcd1504d411647a5b23eb4b8f23c1756 is the actual link. The hash matches, and the code at that link looks reasonable. But!
I checked out https://github.com/udoprog/unc/ and looked through its git log, and could not find that hash in the logs, not in either of the branches posted to github.
Hopefully someone who knows more about git and github can chime in here...
Sorry to chime in (I follow the codebase, but am otherwise not involved). It seems that commit udoprog/unc@6eb764f was made in an (now untracked) branch:
* commit 6238492182785d282af7af03fa2aaceaf1fd8df4 <-- master, stable branch
| Pedantic fixes and adding latin1 as an alias
|
* commit 43d2a9fb31129b5e3e86f2f44440205298c95cc9
| Removed unecessary extra files
|
* commit 0c64d7145a51a76b7c3666f1d7361d5a68f8ac9d
| Update README.md
|
| * commit 6eb764fefcd1504d411647a5b23eb4b8f23c1756 <-- untracked branch
| | Removed redundant semicolons
| |
| * commit 7243a299d66a6aa83a495d0cd1d7d4f6d9bd2588
| | Removed redundant semicolons
|/
* commit 8cbf4b69e83905128a7cd5c2a5607e65a8429c6e
| Updated tools and generated cpp files, updated README
|
* commit b0661e4192a81c883a466dda25df0f778a2bbcfe
| Added gitignore
|
* commit f5c208e12ef0e140a7864417fab2abcb2f6a857d
| Added encode_codepoint
|
* commit 607eab6bf39c6097d75912cc4a0be892d9863df6
| Fixed structural bugs
|
* commit 002e098ed6f284bb563120ba729857a54d0912f3
| Moved generated files to expected location
|
...
If I clone unc, I have no access to this untracked branch. I can only assume that it was once pushed to GitHub, but the tree was later removed or the master tree pointer was changed to track the other branch, leaving the above branch without a name. This normally causes git to lose the commit to the -now untracked- branch. However, it seems that these commit blobs are still present in the GitHub database though.
So you may want to do two things:
- Update the submodule to point to the master or stable tree instead of this untracked tree.
- See if there is a way to recover this untracked branch, and if the commit are useful, rebase or cherry-pick into the master branch.
How you have to do this is left as an exercise to the reader (read: I don't know either).
Sounds to me like the best thing here is for @udoprog to either recover the lost tree or bless a new version of unc.
Thank you for the help! I am very new to submodules. :-)
Jack.
Yep, seems to be fixed now.