Git is consistently deleting 2 directories from my repository, how can I troubleshoot this?

I don't expect someone to solve my problem, but I am not quite sure how to troubleshoot this. If I do a "git status", I get:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    app/controllers/application.rb
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   app/views/main/index.html.erb
#       modified:   public/stylesheets/bandop.css
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       vendor/plugins/contacts/.gitignore
#       vendor/plugins/contacts/.gitmodules

but if I do "git add ." and then "git status", I get:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    app/controllers/application.rb
#       modified:   app/views/main/index.html.erb
#       modified:   public/stylesheets/bandop.css
#       new file:   vendor/plugins/blackbook
#       deleted:    vendor/plugins/blackbook/CHANGES.markdown
#       deleted:    vendor/plugins/blackbook/Manifest.txt
#       deleted:    vendor/plugins/blackbook/README.markdown
#       deleted:    vendor/plugins/blackbook/Rakefile
#       deleted:    vendor/plugins/blackbook/blackbook.gemspec
#       deleted:    vendor/plugins/blackbook/debug_blackbook.rb
#       deleted:    vendor/plugins/blackbook/init.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/base.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/vcf.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/exporter/xml.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/aol.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/base.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/csv.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/freenet.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/gmail.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/gmx.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/hotmail.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/page_scraper.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/web.de.rb
#       deleted:    vendor/plugins/blackbook/lib/blackbook/importer/yahoo.rb
#       deleted:    vendor/plugins/blackbook/test/fixtures/aol_new_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail.csv
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_2a.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_login_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/gmail_redirect_body.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_contacts.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_login_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_first_page.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/hotmail_scrape_response_stage_3.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_bad_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts.csv
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts_not_logged_in.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_contacts_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_login_response_stage_1.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_login_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/fixtures/yahoo_no_user_response_stage_2.html
#       deleted:    vendor/plugins/blackbook/test/freenet_importer_test.rb
#       deleted:    vendor/plugins/blackbook/test/gmx_importer_test.rb
#       deleted:    vendor/plugins/blackbook/test/scripts/live_test.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_base.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_vcf.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_exporter_xml.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_aol.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_base.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_csv.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_gmail.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_hotmail.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_page_scraper.rb
#       deleted:    vendor/plugins/blackbook/test/test_blackbook_importer_yahoo.rb
#       deleted:    vendor/plugins/blackbook/test/test_helper.rb
#       deleted:    vendor/plugins/blackbook/test/web.de_importer_test.rb
#       deleted:    vendor/plugins/blackbook/vendor/plugins/blackbook/lib/autotest/blackbook.rb
#       deleted:    vendor/plugins/blackbook/vendor/plugins/blackbook/lib/autotest/discover.rb
#       new file:   vendor/plugins/contacts
#       deleted:    vendor/plugins/contacts/MIT-LICENSE
#       deleted:    vendor/plugins/contacts/README.rdoc
#       deleted:    vendor/plugins/contacts/Rakefile
#       deleted:    vendor/plugins/contacts/lib/config/contacts.yml
#       deleted:    vendor/plugins/contacts/lib/contacts.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/flickr.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/google.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/version.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/windows_live.rb
#       deleted:    vendor/plugins/contacts/lib/contacts/yahoo.rb
#       deleted:    vendor/plugins/contacts/spec/contact_spec.rb
#       deleted:    vendor/plugins/contacts/spec/feeds/contacts.yml
#       deleted:    vendor/plugins/contacts/spec/feeds/flickr/auth.getFrob.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/flickr/auth.getToken.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/google-many.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/google-single.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/wl_contacts.xml
#       deleted:    vendor/plugins/contacts/spec/feeds/yh_contacts.txt
#       deleted:    vendor/plugins/contacts/spec/feeds/yh_credential.xml
#       deleted:    vendor/plugins/contacts/spec/flickr/auth_spec.rb
#       deleted:    vendor/plugins/contacts/spec/gmail/auth_spec.rb
#       deleted:    vendor/plugins/contacts/spec/gmail/fetching_spec.rb
#       deleted:    vendor/plugins/contacts/spec/rcov.opts
#       deleted:    vendor/plugins/contacts/spec/spec.opts
#       deleted:    vendor/plugins/contacts/spec/spec_helper.rb
#       deleted:    vendor/plugins/contacts/spec/windows_live/windows_live_spec.rb
#       deleted:    vendor/plugins/contacts/spec/yahoo/yahoo_spec.rb
#       deleted:    vendor/plugins/contacts/vendor/windowslivelogin.rb

The problem is I never deleted any of those files, git just thinks I did. My workaround is to do "git add vendor/plugins/contacts/" and "git add vendor/plugins/blackbook/" every time before I commit but this is terrible. Can anyone provide direction on this?

UPDATE:

Thanks to the comments, I have figured out most of the problem. I never treated my plugins as submodules even though they were source controlled.

So far, I have deleted SCM from the blackbook plugin (I don't actually need or want it). And I removed the contacts entirely and did:

git submodule add repo_address local_address
git submodule init
git submodule update
git add vendor/plugins/contacts
git add .
git commit -m "submodule should be committing now"

but now the problem is that while the contacts plugin code exists in my local repo. i can't get it to commit to my remote repo. even after "git add ." or more explicitly "git add vendor/plugins/contacts" ....any ideas here?

Thank you!


Weird. You have a blog entry reporting that exact same issue. With submodules, as mentioned in Dave's answer.

This was only fixed by removing the version control on the “restful_authentication” directory:

.~/projects/bushi2do master $ rm -rf vendor/plugins/restful_authentication/.git
.~/projects/bushi2do master $ git add .
.~/projects/bushi2do master $ git status
# On branch master
nothing to commit (working directory clean)

The downside to this fix is that you can no longer 'git pull' on the plugin's directory to grab the updates.


How about

git rm --cached vendor/plugins/contacts
git rm --cached vendor/plugins/blackbook

?

And how did you declare your submodules within you plugins directory ?

Because I remember a classic catch with submodules.
If you use git submodules, don't do git add foo/ (watch that trailing slash!) if foo is your submodule. It gets messy.

From here:

When you use git add on a submodule, make sure you don't have a tailing slash.

> git add local/path
  -- adds the submodule

> git add local/path/
  -- adds all the files in the submodule directly into your repository, big no-no

无法确定地告诉你,但我会考虑问题是否与指定为git子模块的“blackbook”和“contacts”插件相关。

链接地址: http://www.djcxy.com/p/92358.html

上一篇: 在路径的.gitmodules中没有找到子模块映射

下一篇: Git始终从我的存储库中删除2个目录,我如何解决这个问题?