Skip to content

Commit

Permalink
Fix an edge case in rev_parse.
Browse files Browse the repository at this point in the history
Make sure we don't split on a `ref:path' revision.
  • Loading branch information
sbryant committed Sep 2, 2012
1 parent 83658e5 commit 3811d81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/grit/git-ruby.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3811d81

Please sign in to comment.