Skip to content

Conversation

@sj26
Copy link
Contributor

@sj26 sj26 commented Nov 25, 2017

Joining the repo root doesn't account for .git files which have a gitdir: ... redirect, but Overcommit::Utils.git_dir compensates for that.

Before

my-submodule (master) % overcommit --install
Installing hooks into .../my-repo/vendor/my-submodule
.../lib/ruby/2.4.0/fileutils.rb:230:in `mkdir': File exists @ dir_s_mkdir - .../my-repo/vendor/my-submodule/.git (Errno::EEXIST)
	from .../lib/ruby/2.4.0/fileutils.rb:230:in `fu_mkdir'
	from .../lib/ruby/2.4.0/fileutils.rb:208:in `block (2 levels) in mkdir_p'
	from .../lib/ruby/2.4.0/fileutils.rb:206:in `reverse_each'
	from .../lib/ruby/2.4.0/fileutils.rb:206:in `block in mkdir_p'
	from .../lib/ruby/2.4.0/fileutils.rb:191:in `each'
	from .../lib/ruby/2.4.0/fileutils.rb:191:in `mkdir_p'
	from .../gems/overcommit-0.41.0/lib/overcommit/installer.rb:80:in `ensure_directory'
	from .../gems/overcommit-0.41.0/lib/overcommit/installer.rb:33:in `install'
	from .../gems/overcommit-0.41.0/lib/overcommit/installer.rb:22:in `run'
	from .../gems/overcommit-0.41.0/lib/overcommit/cli.rb:122:in `block in install_or_uninstall'
	from .../gems/overcommit-0.41.0/lib/overcommit/cli.rb:120:in `each'
	from .../gems/overcommit-0.41.0/lib/overcommit/cli.rb:120:in `install_or_uninstall'
	from .../gems/overcommit-0.41.0/lib/overcommit/cli.rb:22:in `run'
	from .../gems/overcommit-0.41.0/bin/overcommit:49:in `<top (required)>'
	from .../bin/overcommit:23:in `load'
	from .../bin/overcommit:23:in `<main>'

After

my-submodule (master) % overcommit --install
Installing hooks into .../my-repo/vendor/my-submodule
Successfully installed hooks into .../my-repo/vendor/my-submodule

👍

@sj26 sj26 force-pushed the fix-install-in-submodule branch from 624f6af to 8227f14 Compare November 28, 2017 23:40
@sj26
Copy link
Contributor Author

sj26 commented Nov 28, 2017

I added a spec here, too.

@sj26 sj26 force-pushed the fix-install-in-submodule branch from 8227f14 to 512b83f Compare November 28, 2017 23:47
Copy link
Contributor

@trotzig trotzig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Code looks good, but it seems like this isn't working correctly on windows machines. Do you have any ideas on what could be wrong?

@sj26
Copy link
Contributor Author

sj26 commented Dec 5, 2017

Windows doesn't seem to understand File.expand_path. Or, rather, ruby doesn't recognize "C:/" as a directory root. I'll try File.realpath.

@sj26 sj26 force-pushed the fix-install-in-submodule branch from 512b83f to fc77cfd Compare December 5, 2017 10:48
Joining the repo root doesn't account for .git files which have a
gitdir: redirect, but Overcommit::Utils.git_dir compensates for that.
@sj26 sj26 force-pushed the fix-install-in-submodule branch from fc77cfd to ce0ed52 Compare December 5, 2017 11:28
@sj26
Copy link
Contributor Author

sj26 commented Dec 5, 2017

Oh, or I specified an absolute path instead of a realtive one and git didn't understand that. Still trying.

@sj26
Copy link
Contributor Author

sj26 commented Dec 5, 2017

So I think I fixed the Windows problem introduced by the specs here, but there's a seemingly-unrelated problem with Ruby 2.1 and parallelization?

@trotzig
Copy link
Contributor

trotzig commented Jan 9, 2018

Yeah, the windows tests are known to be flaky. I'm assuming this is not your fault. Sorry for the delay here.

@trotzig trotzig merged commit 347cd2c into sds:master Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants