You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invoke Bundler Context: File.read() doesn't use the right encoding #868
For some reason, when using Overcommit together with the Git Graph Extension for VSCode, any time a hook runs and it checks on the bundler context (most templates do that), the action fails with this error message: git/hooks/post-checkout:30:in '<main>': invalid byte sequence in US-ASCII (ArgumentError)
It seems that the code there at that line tries to read the file from filesystem but doesn't take into account the encoding of the file.
# Check if Overcommit should invoke a Bundler context for loading gemsFile.read('.overcommit.yml') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
simply adding the encoding explicitly to the File.read() method seems to solve the issue.
I obviously can't do that on my end by overwriting the files, as they are being regenerated all the time.
Would you mind if I create a PR to add the encoding to all templates or does this collide with other things I can't overlook?
# Check if Overcommit should invoke a Bundler context for loading gemsFile.read('.overcommit.yml',encoding: 'UTF-8') =~ /gemfile: (?:false|['"]?(.*)['"]?)/
Thanks so much, it's driving me crazy lately since I can't use my lovely GUI assistant for git anymore..
Activity
sds commentedon Mar 24, 2025
No objection to a PR that fixes this. Thanks for the report!
Read .overcommit.yml as UTF-8 in the hook template (sds#910)