Permalink
Browse files

Fix an edge case in rev_parse.

Make sure we don't split on a `ref:path' revision.
  • Loading branch information...
1 parent 83658e5 commit 3811d8137e361a3874db514eeda1e4ea5cdbe062 @sbryant sbryant committed Sep 2, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/grit/git-ruby.rb
View
@@ -75,7 +75,10 @@ def rev_list(options, *refs)
def rev_parse(options, string)
raise RuntimeError, "invalid string: #{string.inspect}" unless string.is_a?(String)
- if string =~ /\.\./
+ # Split ranges, but don't split when specifying a ref:path.
+ # Don't split HEAD:some/path/in/repo..txt
+ # Do split sha1..sha2
+ if string !~ /:/ && string =~ /\.\./
(sha1, sha2) = string.split('..')
return [rev_parse({}, sha1), rev_parse({}, sha2)]
end

0 comments on commit 3811d81

Please sign in to comment.