Permalink
Browse files

Merge pull request #140 from sbryant/fix_rev_parse

Fix an edge case in rev_parse.
  • Loading branch information...
2 parents 83658e5 + 3811d81 commit 4cdb531daea7551d8e69e52744f75187c51cfa80 @rtomayko rtomayko committed Sep 4, 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 4cdb531

Please sign in to comment.