Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename `Rugged::Branch.find` to `Rugged::Branch.lookup`.

  • Loading branch information...
commit 8839c7dc6e2e3a447cc662f55a156bdb634ee35f 1 parent 8e50440
@arthurschreiber authored committed
View
2  lib/rugged/branch.rb
@@ -1,6 +1,6 @@
module Rugged
class Branch
- def self.find(repo, name)
+ def self.lookup(repo, name)
if name == "HEAD" || name.match(%r{^(refs/heads/|refs/remotes/)})
ref = repo.ref(name)
else
View
4 lib/rugged/repository.rb
@@ -122,7 +122,7 @@ def remotes
end
def branches
- Rugged::Branch.each(self).map { |name| Rugged::Branch.find(self, name) }
+ Rugged::Branch.each(self).map { |name| Rugged::Branch.lookup(self, name) }
end
def create_branch(name, sha_or_ref = "HEAD")
@@ -138,7 +138,7 @@ def create_branch(name, sha_or_ref = "HEAD")
end
Branch.create(self, name, target)
- Branch.find(self, name)
+ Branch.lookup(self, name)
end
# Get the content of a file at a specific revision.
View
12 test/branch_test.rb
@@ -29,14 +29,14 @@
end
end
-context "Rugged::Branch.find" do
+context "Rugged::Branch.lookup" do
setup do
@path = temp_repo("testrepo.git")
@repo = Rugged::Repository.new(@path)
end
test "can look up local branches" do
- branch = Rugged::Branch.find(@repo, "master")
+ branch = Rugged::Branch.lookup(@repo, "master")
refute_nil branch
assert_equal "master", branch.name
@@ -45,7 +45,7 @@
end
test "can look up a local branch by its canonical name" do
- branch = Rugged::Branch.find(@repo, "refs/heads/master")
+ branch = Rugged::Branch.lookup(@repo, "refs/heads/master")
refute_nil branch
assert_equal "master", branch.name
@@ -54,7 +54,7 @@
end
test "can look up remote branches" do
- branch = Rugged::Branch.find(@repo, "origin/packed")
+ branch = Rugged::Branch.lookup(@repo, "origin/packed")
refute_nil branch
assert_equal "origin/packed", branch.name
@@ -63,7 +63,7 @@
end
test "can look up a local branch by its canonical name" do
- branch = Rugged::Branch.find(@repo, "refs/remotes/origin/packed")
+ branch = Rugged::Branch.lookup(@repo, "refs/remotes/origin/packed")
refute_nil branch
assert_equal "origin/packed", branch.name
@@ -75,7 +75,7 @@
new_branch = @repo.create_branch("Ångström", "5b5b025afb0b4c913b4c338a42934a3863bf3644")
refute_nil new_branch
- retrieved_branch = Rugged::Branch.find(@repo, "Ångström")
+ retrieved_branch = Rugged::Branch.lookup(@repo, "Ångström")
refute_nil retrieved_branch
assert_equal new_branch, retrieved_branch
Please sign in to comment.
Something went wrong with that request. Please try again.