Skip to content

Add support for working with git-worktree #336

Closed
@egh

Description

@egh

Steps to reproduce:

git init foo && cd foo
echo "gem 'overcommit'" > Gemfile
bundle install
overcommit
overcommit --sign
git add Gemfile* .overcommit.yml 
git commit -a -m 'init'
git worktree add ../foo-a

Expected behavior: no error.

Actual behavior (after running git worktree add ../foo-a):

Enter ../foo-a (identifier foo-a)
Switched to a new branch 'foo-a'
No such file or directory @ rb_file_s_size - /home/egh/foo/.git/worktrees/foo-a/hooks/overcommit-hook
/home/egh/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:815:in `size'
/home/egh/.rbenv/versions/2.2.3/lib/ruby/2.2.0/fileutils.rb:815:in `compare_file'
/home/egh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/overcommit-0.31.0/lib/overcommit/installer.rb:54:in `update'
/home/egh/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/overcommit-0.31.0/lib/overcommit/installer.rb:20:in `run'
/home/egh/foo/.git/hooks/post-checkout:67:in `<main>'
Report this bug at https://github.com/brigade/overcommit/issues

Environment:
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]
overcommit: 0.31.0
git version 2.5.0
os: GNU/Linux, Ubuntu 15.10

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions