inch diff fails, when workdir != repo-root
alexJunger opened this issue · 2 comments
When i inch diff
in a subdirectory of a git repository, I get this error:
$ inch diff
fatal: repository '....' does not exist
..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/utils/shell_helper.rb:5:in `chdir': No such file or directory @ dir_chdir - /var/folders/c0/cyfbk3cj52l9dbgp0_1z1spc0000gn/T/d20151019-81364-1fdhjhl/.... (Errno::ENOENT)
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/utils/shell_helper.rb:5:in `git'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/api/diff.rb:64:in `git_reset'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/api/diff.rb:52:in `block in codebase_from_copy'
from ..../.rubies/ruby-2.2.3/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/api/diff.rb:50:in `codebase_from_copy'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/api/diff.rb:36:in `codebase_for'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/api/diff.rb:21:in `initialize'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command/diff.rb:26:in `new'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command/diff.rb:26:in `run'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command/base.rb:52:in `run'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command_parser.rb:100:in `run_command'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command_parser.rb:62:in `run'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/lib/inch/cli/command_parser.rb:52:in `run'
from ..../.gem/ruby/2.2.3/gems/inch-0.7.0/bin/inch:23:in `<top (required)>'
from ..../.gem/ruby/2.2.3/bin/inch:23:in `load'
from ..../.gem/ruby/2.2.3/bin/inch:23:in `<main>'
The ShellHelper
is pretty basic, so I'm not really seeing where this comes from, exactly. The cause might even be my own environment, to be honest.
Btw: Nice talk at euruko this weekend! I used your gem today to clean up faulty documentation - with great success.
Hi, thanks for the bug report! 👍
You can't run inch diff
from a subdir, but you can run it from your repository's root like this
$ inch diff lib/optparse
where lib/optparse
is a directory. Then it will only check that directory. Will publish Inch v0.7.1 today to catch the error message and print a helpful message!
I apologize for the age/inactivity on this issue. I should have done a better job at resolving this properly. 😥
Please feel free to re-open this issue at your discretion.