Skip to content

Commit

Permalink
Use Repository#rev_parse_oid in Repository#create_branch
Browse files Browse the repository at this point in the history
This is the purpose-built API to lookup an arbitrary treeish, and since
git_lookup_reference() returns a new error code, it messed up the original two-stage
lookup.
  • Loading branch information
Scott J. Goldman committed Oct 24, 2012
1 parent 158e51f commit 77c5a25
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/rugged/repository.rb
Expand Up @@ -140,11 +140,7 @@ def create_branch(name, sha_or_ref = "HEAD")
when Rugged::Object
target = sha_or_ref.oid
else
if (ref = Rugged::Reference.lookup(self, sha_or_ref))
target = ref.resolve.target
else
target = Rugged::Commit.lookup(self, sha_or_ref)
end
target = rev_parse_oid(sha_or_ref)
end

Branch.create(self, name, target)
Expand Down

0 comments on commit 77c5a25

Please sign in to comment.