Skip to content

Commit 33f100f

Browse files
author
robertodecurnex
committed
revparse: Supporting ref names containing SHA like substrings (40-hex strings) - closes ruby-git#155
1 parent d4c4a6a commit 33f100f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/git/lib.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def full_log_commits(opts={})
9898
end
9999

100100
def revparse(string)
101-
return string if string =~ /[A-Fa-f0-9]{40}/ # passing in a sha - just no-op it
101+
return string if string =~ /^[A-Fa-f0-9]{40}$/ # passing in a sha - just no-op it
102102
rev = ['head', 'remotes', 'tags'].map do |d|
103103
File.join(@git_dir, 'refs', d, string)
104104
end.find do |path|

0 commit comments

Comments
 (0)