Skip to content
Browse files

Allow sources to do their own matching

They know it better, after all
  • Loading branch information...
1 parent 12b3d39 commit a85911417d0d57924de02a20866de771e6d7369c @pieter committed Jul 22, 2008
Showing with 5 additions and 8 deletions.
  1. +1 −3 lib/git.rb
  2. +1 −1 lib/git/sources/gitweb.rb
  3. +2 −2 test/gitweb/sources/gitweb.rb
  4. +1 −2 test/gitweb/sources/repo.rb
View
4 lib/git.rb
@@ -28,9 +28,7 @@ def git_channel(channel)
end
def handle_extended(channel, repo, ref, tree)
- match = repo ? /\b#{repo}\.git/ : nil
-
- l = channel.lookup(ref, match, tree)
+ l = channel.lookup(ref, repo, tree)
# Fail loudly if there is no match, but there is a tree or repo specified
if !l && (tree || repo)
View
2 lib/git/sources/gitweb.rb
@@ -23,7 +23,7 @@ def name
end
def matches?(match)
- return @url =~ match
+ return @url =~ /\b#{match}[a-z]*\.git/
end
def object_url(ref, file)
View
4 test/gitweb/sources/gitweb.rb
@@ -18,8 +18,8 @@ def test_object_url
end
def test_matches
- assert(@source.matches?(/gitbot/))
- assert(@source.matches?(/gitbot.git/))
+ assert(@source.matches?("gitbot"))
+ assert(@source.matches?("git"))
end
def test_lookup_HEAD
View
3 test/gitweb/sources/repo.rb
@@ -18,8 +18,7 @@ def test_object_url
end
def test_matches
- assert(@source.matches?(/git/))
- assert(@source.matches?(/git.git/))
+ assert(@source.matches?("git"))
end
def test_lookup_HEAD

0 comments on commit a859114

Please sign in to comment.
Something went wrong with that request. Please try again.