Permalink
Browse files

ruby rev_list passes --verify to native rev_parse in fallback

Otherwise, the git-rev-parse will return whatever is given as an arg
when the ref doesn't exist. e.g.,

  $ git rev-parse some-bad-ref
  some-bad-ref
  fatal: ambiguous argument 'some-bad-ref': unknown revision or path not in the working tree.

The error message is on stderr and git-rev-parse exits with non-zero
but the ref name is still output.

The problem here is that code often calls rev_list like:

    git.rev_list({}, "some-bad-ref")

Then rev_list tries to convert some-bad-ref to a SHA1, gets back the
ref string, but continues on anyway. This eventually results in the
rev_list failing to look up the object because it assumes its a SHA1
when its really a ref string.
  • Loading branch information...
1 parent 1c03f3e commit b0135670e0002fee8491ea1e15e7308817e9a255 @rtomayko rtomayko committed Jun 15, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/grit/git-ruby.rb
View
@@ -64,7 +64,7 @@ def rev_list(options, *refs)
end
else
ref = refs.first
- aref = rev_parse({}, ref)
+ aref = rev_parse({:verify => true}, ref)
if aref.is_a? Array
method_missing('rev-list', options, *refs)
else

0 comments on commit b013567

Please sign in to comment.