Open sleekweasel opened 4 years ago
I've just encountered this again. Renamed files are still showing up in two places:
Obviously, check-in triggers should filter out untracked files anyway, and we're doing that now - fixing a typo in our script - but it's still rather confusing.
Thanks for the report. Can you clarify which hook was demonstrating this behavior?
Furthermore, can you confirm the version of git
and overcommit
you are currently using? (since it's been a while since you originally opened)
I'll add onto this @sds since the conversation stopped. It's any hook that uses applicable_files
, which is pretty much all of them.
Put simply, applicable_files
is including deleted files. So when you are using the JsonSyntax linter for example, it will try to open a deleted file and raise an error like so:
No such file or directory @ rb_sysopen - ~/sandbox/DELETE_ME.json
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/pre_commit/json_syntax.rb:11:in `read'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/pre_commit/json_syntax.rb:11:in `block in run'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/pre_commit/json_syntax.rb:9:in `each'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/pre_commit/json_syntax.rb:9:in `run'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/base.rb:47:in `block in run_and_transform'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/utils.rb:260:in `with_environment'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook/base.rb:47:in `run_and_transform'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook_runner.rb:161:in `run_hook'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook_runner.rb:97:in `block in consume'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook_runner.rb:94:in `loop'
~/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/overcommit-0.58.0/lib/overcommit/hook_runner.rb:94:in `consume'
I'm using Git 2.34.0 and Overcommit 0.58.0.
Ahh, correction! It's not when you actually run git commit
but when you run overcommit -r
!
overcommit 0.47.0
This commit:
fails when running rspec tests because it still sees the moved/deleted files:
The deleted/renamed files shouldn't be showing up.