{"action":"created","issue":{"url":"https://api.github.com/repos/brigade/overcommit/issues/168","labels_url":"https://api.github.com/repos/brigade/overcommit/issues/168/labels{/name}","comments_url":"https://api.github.com/repos/brigade/overcommit/issues/168/comments","events_url":"https://api.github.com/repos/brigade/overcommit/issues/168/events","html_url":"https://github.com/brigade/overcommit/issues/168","id":67162814,"number":168,"title":"Error when removing submodule","user":{"login":"lencioni","id":195534,"avatar_url":"https://avatars.githubusercontent.com/u/195534?v=3","gravatar_id":"","url":"https://api.github.com/users/lencioni","html_url":"https://github.com/lencioni","followers_url":"https://api.github.com/users/lencioni/followers","following_url":"https://api.github.com/users/lencioni/following{/other_user}","gists_url":"https://api.github.com/users/lencioni/gists{/gist_id}","starred_url":"https://api.github.com/users/lencioni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lencioni/subscriptions","organizations_url":"https://api.github.com/users/lencioni/orgs","repos_url":"https://api.github.com/users/lencioni/repos","events_url":"https://api.github.com/users/lencioni/events{/privacy}","received_events_url":"https://api.github.com/users/lencioni/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brigade/overcommit/labels/bug","name":"bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/brigade/overcommit/milestones/1","html_url":"https://github.com/brigade/overcommit/milestones/0.24.0","labels_url":"https://api.github.com/repos/brigade/overcommit/milestones/1/labels","id":1059392,"number":1,"title":"0.24.0","description":null,"creator":{"login":"lencioni","id":195534,"avatar_url":"https://avatars.githubusercontent.com/u/195534?v=3","gravatar_id":"","url":"https://api.github.com/users/lencioni","html_url":"https://github.com/lencioni","followers_url":"https://api.github.com/users/lencioni/followers","following_url":"https://api.github.com/users/lencioni/following{/other_user}","gists_url":"https://api.github.com/users/lencioni/gists{/gist_id}","starred_url":"https://api.github.com/users/lencioni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lencioni/subscriptions","organizations_url":"https://api.github.com/users/lencioni/orgs","repos_url":"https://api.github.com/users/lencioni/repos","events_url":"https://api.github.com/users/lencioni/events{/privacy}","received_events_url":"https://api.github.com/users/lencioni/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2015-04-08T22:56:37Z","updated_at":"2015-04-09T02:45:04Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-04-08T16:02:37Z","updated_at":"2015-04-10T00:23:01Z","closed_at":null,"body":"I just ran into an interesting error when trying to make a commit that only removes a submodule. Here's what I did:\r\n\r\n```sh\r\ngit submodule deinit path/to/submodule\r\ngit rm path/to/submodule\r\nrm -rf .git/modules/path/to/submodule\r\ngit commit\r\n```\r\n\r\nThe first time I tried committing, it ran the hooks but there were errors. The second time I tried committing, I get the following output:\r\n\r\n```\r\nUnable to setup environment for pre-commit hook run:\r\nSTDOUT:\r\nSTDERR:error: path/to/submodule: is a directory - add files inside instead\r\nfatal: Unable to process path path/to/submodule\r\nCannot save the current worktree state\r\n```\r\n\r\nIf I run `git status` everything looks as I would expect.\r\n\r\nDoing this makes things work again:\r\n\r\n```sh\r\ngit reset\r\ngit add .gitmodules\r\ngit rm path/to/submodule\r\n```\r\n\r\nI'm not really sure if this is a problem with overcommit or with git, but I figured I would start here."},"comment":{"url":"https://api.github.com/repos/brigade/overcommit/issues/comments/91387326","html_url":"https://github.com/brigade/overcommit/issues/168#issuecomment-91387326","issue_url":"https://api.github.com/repos/brigade/overcommit/issues/168","id":91387326,"user":{"login":"sds","id":677877,"avatar_url":"https://avatars.githubusercontent.com/u/677877?v=3","gravatar_id":"","url":"https://api.github.com/users/sds","html_url":"https://github.com/sds","followers_url":"https://api.github.com/users/sds/followers","following_url":"https://api.github.com/users/sds/following{/other_user}","gists_url":"https://api.github.com/users/sds/gists{/gist_id}","starred_url":"https://api.github.com/users/sds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sds/subscriptions","organizations_url":"https://api.github.com/users/sds/orgs","repos_url":"https://api.github.com/users/sds/repos","events_url":"https://api.github.com/users/sds/events{/privacy}","received_events_url":"https://api.github.com/users/sds/received_events","type":"User","site_admin":false},"created_at":"2015-04-10T00:23:01Z","updated_at":"2015-04-10T00:23:01Z","body":"I can confirm `git_repo_spec.rb` fails on git 1.8.3.1.\r\n\r\n```\r\n$ bundle exec rspec spec/overcommit/git_repo_spec.rb\r\n[Coveralls] Set up the SimpleCov formatter.\r\n[Coveralls] Using SimpleCov's default settings.\r\n..FF\r\n\r\nFailures:\r\n\r\n  1) Overcommit::GitRepo.staged_submodule_removals when there is one submodule removal staged returns the submodule that was removed\r\n     Failure/Error: subject.size.should == 1\r\n       expected: 1\r\n            got: 0 (using ==)\r\n     # ./spec/overcommit/git_repo_spec.rb:41:in `block (4 levels) in <top (required)>'\r\n     # ./spec/overcommit/git_repo_spec.rb:15:in `block (4 levels) in <top (required)>'\r\n     # ./spec/support/git_spec_helpers.rb:16:in `call'\r\n     # ./spec/support/git_spec_helpers.rb:16:in `block in repo'\r\n     # ./spec/support/git_spec_helpers.rb:27:in `call'\r\n     # ./spec/support/git_spec_helpers.rb:27:in `block (3 levels) in directory'\r\n     # ./spec/support/git_spec_helpers.rb:26:in `chdir'\r\n     # ./spec/support/git_spec_helpers.rb:26:in `block (2 levels) in directory'\r\n     # ./spec/support/git_spec_helpers.rb:24:in `chdir'\r\n     # ./spec/support/git_spec_helpers.rb:24:in `block in directory'\r\n     # ./spec/support/git_spec_helpers.rb:23:in `tap'\r\n     # ./spec/support/git_spec_helpers.rb:23:in `directory'\r\n     # ./spec/support/git_spec_helpers.rb:8:in `repo'\r\n     # ./spec/overcommit/git_repo_spec.rb:12:in `block (3 levels) in <top (required)>'\r\n\r\n  2) Overcommit::GitRepo.staged_submodule_removals when there are multiple submodule removals staged returns all submodules that were removed\r\n     Failure/Error: subject.size.should == 2\r\n       expected: 2\r\n            got: 0 (using ==)\r\n     # ./spec/overcommit/git_repo_spec.rb:62:in `block (4 levels) in <top (required)>'\r\n     # ./spec/overcommit/git_repo_spec.rb:15:in `block (4 levels) in <top (required)>'\r\n     # ./spec/support/git_spec_helpers.rb:16:in `call'\r\n     # ./spec/support/git_spec_helpers.rb:16:in `block in repo'\r\n     # ./spec/support/git_spec_helpers.rb:27:in `call'\r\n     # ./spec/support/git_spec_helpers.rb:27:in `block (3 levels) in directory'\r\n     # ./spec/support/git_spec_helpers.rb:26:in `chdir'\r\n     # ./spec/support/git_spec_helpers.rb:26:in `block (2 levels) in directory'\r\n     # ./spec/support/git_spec_helpers.rb:24:in `chdir'\r\n     # ./spec/support/git_spec_helpers.rb:24:in `block in directory'\r\n     # ./spec/support/git_spec_helpers.rb:23:in `tap'\r\n     # ./spec/support/git_spec_helpers.rb:23:in `directory'\r\n     # ./spec/support/git_spec_helpers.rb:8:in `repo'\r\n     # ./spec/overcommit/git_repo_spec.rb:12:in `block (3 levels) in <top (required)>'\r\n\r\nFinished in 1.37 seconds (files took 0.47412 seconds to load)\r\n4 examples, 2 failures\r\n\r\nFailed examples:\r\n\r\nrspec ./spec/overcommit/git_repo_spec.rb:40 # Overcommit::GitRepo.staged_submodule_removals when there is one submodule removal staged returns the submodule that was removed\r\nrspec ./spec/overcommit/git_repo_spec.rb:61 # Overcommit::GitRepo.staged_submodule_removals when there are multiple submodule removals staged returns all submodules that were removed\r\n```"}}