on
git svn dcommit
it starts commiting and then I get this
A spec/controllers/authenticated_system_spec.rb
A spec/controllers/sessions_controller_spec.rb
A spec/controllers/users_controller_spec.rb
A spec/fixtures/users.yml
A spec/helpers/users_helper_spec.rb
A spec/models/user_spec.rb
A vendor/plugins/haml/init.rb
A vendor/plugins/restful_authentication
7235d9150e8beb80a819923a4c871ef4069c6759 doesn't exist in the repository at /opt/local/libexec/git-core/git-svn line 4706
Failed to read object 7235d9150e8beb80a819923a4c871ef4069c6759 at /opt/local/libexec/git-core/git-svn line 570
any ideas how one goes about fixing this one?
tried inspecting with git fsck --full
but git repo and all git commands seem to work fine just can't dcommit.
I had this same problem (where I had done a git clone and I'm using git svn). Here's the command I used to remove the submodule:
I found this wonderful solution on this blog
Did you create submodules in your Git repo ?
This blog post seems to mention that as an issue.
This method does essentially the same as the accepted answer from @VonC but is expanded to make it easier to follow.
The situation
This is the error I was getting when issuing
git svn dcommit
I had a number of commits in git that I was attempting to push upstream, and
#object#
was the SHA1 hash id of one of those commits2d061be916dc4c2d54eed7b169f1dd80ecf04bc4
in my case.I had included several other git repos from another sources into my project tree. While I hadn't explicitly added them as git submodules I did
git add <existing_repo_path>
. git notices the .git file and addsexisting_repo_path
as a special case directory (i.e. as a submodule). These directories are the herring bones that causegit-svn
to choke.To Fix
This will find any directory that was added as a submodule.
Remove the special directories from git while leaving the files on the filesystem:
Rename or delete the
.git
files from the submodule directories. Renaming the.git
files offers a little bit of protection since you could revert back.If you had explicitly added submodules you may need to remove the
.gitmodules
file at the root of the repo. You should probably edit this file first to check if there is anything in it you want before removing it.The submodule directories can now be added back into git and will be treated as ordinary subtrees (i.e. no longer submodules or special case directories).
Commit these new files.
The head of the git repo is now good. But git-svn will still choke because it will attempt to create versions from the git history. This means the git history needs to be changed. My approach is to squash all of the git commits made since the last successful
git svn dcommit
into a single commit. That way the new single commit will contain only the current head and not the troublesome 'submodule' versions.To find the last successful svn commit use:
I get something like:
The output shows the SVN number (
r2917
) followed by the equivalent git commit id (094ed52
)Next start an interactive rebase of all the versions since this commit:
This will open an editor with something like this:
pick
means keep this commit,squash
means include these changes into the next commit. Replace all 'pick' with 'squash' except the first line.Save and exit this file and you should get a new single commit.
Now works!