Git is a wonderful system. It has all kinds of nooks and crannies that one forgets about. Anyway, I was doing client work this morning, and my build server (Integrity, but this isn’t about Integrity) didn’t fail, although my local tests were failing. I began investigating, and vendor/plugins wasn’t even on the build server. Uh? I began investigating, and found vendor/plugins had turned into a git submodule a while back. I even had the commit’s SHA1 of when that happened. I found myself in the unenvious position of having to find and install every plugin we had before that commit back into the application.

1 # 04f7e1 is the commit when the submodule was born
2 # Checkout the commit before that error occured
3 $ git checkout 04f7e1^
4 $ ls vendor/plugins > plugins
5 $ git checkout master
6 $ cat plugins
7 $ script/plugin install git://github.com/giraffesoft/timeline_fu.git
8 # And so on, for the 9 other plugins

And then, there was this one plugin which we haven’t released yet which I was missing. It’s called configurable_mailer, and allows us to configure ActionMailer::Base from tests and from some environment variables. Anyway, I again checked out the code from 04f7e1^, copied vendor/plugins/configurable_mailer outside the repository, checked out master again, and moved the plugin back into place. As you can imagine, this was painful. And error-prone. Then I ran my tests, and immediately had errors. This application is based off of Blank, and was using slightly modified versions of certain plugins. So I added Blank as a remote, fetched and merged. Ran my tests again. Still had errors. And lots of them:

 1 $ rake test:units
 2 (in /Users/francois/Projects/project)
 3 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -Ilib:test "/Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/unit/account_activation_mailer_test.rb" "test/unit/company_test.rb" "test/unit/event_test.rb" "test/unit/fanship_test.rb" "test/unit/internal_message_test.rb" "test/unit/job_application_test.rb" "test/unit/job_creation_presenter_test.rb" "test/unit/job_suggestion_test.rb" "test/unit/job_test.rb" "test/unit/media_test.rb" "test/unit/message_mailer_test.rb" "test/unit/message_test.rb" "test/unit/password_reset_mailer_test.rb" "test/unit/person_test.rb" "test/unit/profile_url_test.rb" "test/unit/recommendation_mailer_test.rb" "test/unit/recommendation_presenter_test.rb" "test/unit/recommendation_test.rb" "test/unit/relationship_test.rb" "test/unit/timeline_event_test.rb" 
 4 Loaded suite /Library/Ruby/Gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
 5 Started
 6 ............FFF.........EEEEEEEEEEEEE........................FFFFFFFFFFFFFFFFFFFF.F....F.....EF..EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE.................................................................................................................................................................................................................................................................................................................................................................................................
 7 Finished in 45.235105 seconds.
 8 
 9 542 tests, 762 assertions, 26 failures, 73 errors

Bad, I’m telling you. Then I remembered something about git checkout being able to checkout certain paths. I read about this somewhere but I can’t find the source, anymore. Sorry! Without even reading the manual, I set out to work.

1 $ get checkout -b fix
2 $ git rm -r vendor/plugins
3 $ git checkout -m "Removing submodule'd vendor/plugins (how did that happen?)"
4 $ git checkout 04f7e1^ -- vendor/plugins

Wall clock time? 10 seconds. I was ready to add and commit.

This is a post to remind you to know your tools, and know them well. Sorry I can’t stay anymore. I’m off to read autotest’s source and documentation, again.

Search

Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend

Links

Projects I work on

Projects I worked on