Carthage: Parse error: expected submodule commit SHA in output of task

Created on 22 Feb 2016  ยท  13Comments  ยท  Source: Carthage/Carthage

โžœ  IKnowKungFu git:(master) โœ— bin/setup
*** Fetching Nimble
*** Fetching Quick
*** Fetching CleanroomLogger
*** Fetching CleanroomASL
Parse error: expected submodule commit SHA in output of task (ls-tree -z HEAD Carthage/Checkouts/CleanroomLogger) but encountered:

Reproducible by cloning http://github.com/maximveksler/IKnowKungFu and running bin/setup from the root of the repo.

Complimentary StackOverflow post http://stackoverflow.com/questions/35556157/git-submodules-defined-by-carthage-not-being-fetched

At this point personally curious as to what is going on.

Please help..

question

Most helpful comment

All of this comment has been mentioned above, somewhere.

For me, the issue was to remove the submodule

  • git rm the_submodule
  • rm -rf .git/modules/the_submodule

Delete the entry from .gitmodules

And then check in. This last step was critical!

All 13 comments

You still have submodule entries of Carthage/Checkouts/CleanroomASL and Carthage/Checkouts/CleanroomLogger in .gitmodules. You should run git submodule deinit against them and commit the change.

@ikesyo doesn't seem to be the case.

โžœ  IKnowKungFu git:(master) git rm Carthage/Checkouts/CleanroomASL
fatal: pathspec 'Carthage/Checkouts/CleanroomASL' did not match any files
โžœ  IKnowKungFu git:(master) git submodule deinit Carthage/Checkouts/CleanroomASL
error: pathspec 'Carthage/Checkouts/CleanroomASL' did not match any file(s) known to git.
โžœ  IKnowKungFu git:(master) git rm Carthage/Checkouts/CleanroomLogger
fatal: pathspec 'Carthage/Checkouts/CleanroomLogger' did not match any files
โžœ  IKnowKungFu git:(master) git submodule deinit Carthage/Checkouts/CleanroomLogger
error: pathspec 'Carthage/Checkouts/CleanroomLogger' did not match any file(s) known to git.
โžœ  IKnowKungFu git:(master) git submodule deinit -f Carthage/Checkouts/CleanroomLogger
error: pathspec 'Carthage/Checkouts/CleanroomLogger' did not match any file(s) known to git.
โžœ  IKnowKungFu git:(master) git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
โžœ  IKnowKungFu git:(master) bin/setup
*** Fetching Nimble
*** Fetching Quick
*** Fetching CleanroomLogger
*** Fetching CleanroomASL
Parse error: expected submodule commit SHA in output of task (ls-tree -z HEAD Carthage/Checkouts/CleanroomLogger) but encountered:

Also please see that my .git/config does not contain entries for these modules

โžœ  IKnowKungFu git:(master) cat .git/config
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = [email protected]:maximveksler/IKnowKungFu.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[submodule "Carthage/Checkouts/Nimble"]
    url = https://github.com/Quick/Nimble.git
[submodule "Carthage/Checkouts/Quick"]
    url = https://github.com/Quick/Quick.git

.gitmodules does contain (partial) mentions of them, but even if I remove these entries manually I'm still unable to successfully call carthage update

โžœ IKnowKungFu git:(master) carthage version
0.14.0
โžœ IKnowKungFu git:(master) git --version
git version 2.7.1

What's the output of git status in your carthage checkout? You're probably not at a clean slate for git.

@younata confirmed this to be reproducible both locally on a clean clone and on a remote independent friends Mac.

โžœ  IKnowKungFu git:(master) git branch --list
* master
โžœ  IKnowKungFu git:(master) git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

If you mind, could you please clone the repo and confirm the same is occurring for you?

Huh.

you$ git clone [email protected]:maximveksler/IKnowKungFu.git
Cloning into 'IKnowKungFu'...
remote: Counting objects: 46, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 46 (delta 12), reused 37 (delta 3), pack-reused 0
Receiving objects: 100% (46/46), 19.85 KiB | 0 bytes/s, done.
Resolving deltas: 100% (12/12), done.
Checking connectivity... done.
Rachels-MacBook-Pro:foo you$ cd IKnowKungFu/
Rachels-MacBook-Pro:IKnowKungFu you$ bin/setup
*** Fetching Nimble
*** Fetching Quick
*** Cloning CleanroomLogger
*** Cloning CleanroomASL
Parse error: expected submodule commit SHA in output of task (ls-tree -z HEAD Carthage/Checkouts/CleanroomLogger) but encountered:
Rachels-MacBook-Pro:IKnowKungFu you$ carthage version
0.14.0
Rachels-MacBook-Pro:IKnowKungFu you$

So, turns out that CleanroomLogger and CleanroomASL aren't being downloaded, duh.

Properly deleting all submodules (git submodule deinit Carthage/Checkout/Nimble && git rm Carthage/Checkout/Nimble etc), modifying bin/setup to not use submodules, commit (the commit was important, actually). Problem fixed. Computers are hard, sometimes.

I'll submit a pull request to you. Closing for now.

Computers are hard, sometimes.

But but how does this solve the problem? Are you sure you want to turn this into a closed Q? I don't disagree if this is the consensus but it sure does seem like it could perhaps be better tackled?

You're right, forgive me.

So, what happened (I think) is that you had Carthage/Checkouts under .gitignore. Checking out a git submodules to a directory that is ignored basically no-ops (it does print an error message telling you what you did doesn't make sense, but Carthage doesn't print git error messages as I recall). So, Carthage tried looking for this submodule that wasn't actually there, and couldn't be there, and it would error out.

However, when I removed Carthage/Checkouts from the .gitignore file, then the error still persisted, which is worthy of more explanation from someone more experienced in git than I. (I've been bitten multiple times by submodules before, I don't trust myself to not screw them up).

@ikesyo: thoughts?

While we wait for ikesyo input.

@younata 2 side notes:

  1. I would strongly suggest having Carthage produce an error and refusing the --use-submodules instructions when user has Carthage/Checkouts in her .gitignore.
  2. I am interested in checking out with submodules, it's a feature of Carthage that is appealing to me as it allows me to have a setup similar to the one described here https://robots.thoughtbot.com/creating-your-first-ios-framework where I can have 3rd party code projects code accessible from within Xcode during the development in an easy no extra effort kind of way, a step to what has been discussed here http://comments.gmane.org/gmane.comp.lang.swift.evolution/6858

I would strongly suggest having Carthage produce an error and refusing the --use-submodules instructions when user has Carthage/Checkouts in her .gitignore.

That's a great idea. Filed as https://github.com/Carthage/Carthage/issues/1153.

This _is_ an issue with https://github.com/maximveksler/IKnowKungFu.

Git submodules have 2 parts:

  1. An entry in .gitmodules
  2. A reference to SHA of the submodule in Git's tree structure

Your repository is missing the second item for CleanroomLogger and CleanroomASL. (Notice that these projects don't show up on GitHub: https://github.com/maximveksler/IKnowKungFu/tree/master/Carthage/Checkouts)

You can fix this by removing the entries for those two repos your .gitmodules and committing it _or_ readd them like git submodule add --force https://github.com/emaloney/CleanroomLogger.git Carthage/Checkouts/CleanroomLogger.

Then you will be able to run the carthage command.

All of this comment has been mentioned above, somewhere.

For me, the issue was to remove the submodule

  • git rm the_submodule
  • rm -rf .git/modules/the_submodule

Delete the entry from .gitmodules

And then check in. This last step was critical!

@drosenstark it's probably logical that you would need to commit, as I assume git submodules command looks in the .git file structure for submodules and not in the current working directory. Debatable, but it's how it's currently implemented.

Was this page helpful?
0 / 5 - 0 ratings