Skip to content

Raises error when git configuration diff.mnemonicprefix is enabled #20

@dsbonev

Description

@dsbonev

Output is

.gem/ruby/2.1.2/gems/rubocop-git-0.1.1/lib/rubocop/git/diff_parser.rb:24:in `block in parse': undefined method `patch' for nil:NilClass (NoMethodError)

The following regex does not match the patched file name

[1] pry(main)> '+++ i/test.rb' =~ %r{^\+{3} b/(?<path>[^\t\n\r]+)} 
=> nil

It has i/ prefix instead of b/ because I have diff.mnemonicprefix enabled.

To fix this I would suggest either (1) handle the mnemonic prefixes as well or (2) pass configuration option when this gem executes the git diff command git -c diff.mnemonicprefix=false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions