Skip to content

Commit

Permalink
Auto merge of #1122 - alexcrichton:issue-1119, r=brson
Browse files Browse the repository at this point in the history
It looks like tags don't always point to tag objects, but rather sometimes to
commits themselves. This tweaks the peeling logic for tags to find an *object*
first, and then peel to a commit, rather than finding a tag first and then
peeling.

Closes #1119
  • Loading branch information
bors committed Jan 8, 2015
2 parents d96e974 + df19160 commit c4e9e6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::{USER_DIR};
use std::io::fs::{mkdir_recursive, rmdir_recursive, PathExtensions};
use rustc_serialize::{Encodable, Encoder};
use url::Url;
use git2;
use git2::{mod, ObjectType};

use core::GitReference;
use util::{CargoResult, ChainError, human, ToUrl, internal};
Expand Down Expand Up @@ -185,8 +185,8 @@ impl GitDatabase {
try!((|:| {
let refname = format!("refs/tags/{}", s);
let id = try!(self.repo.refname_to_id(refname.as_slice()));
let tag = try!(self.repo.find_tag(id));
let obj = try!(tag.peel());
let obj = try!(self.repo.find_object(id, None));
let obj = try!(obj.peel(ObjectType::Commit));
Ok(obj.id())
}).chain_error(|| {
human(format!("failed to find tag `{}`", s))
Expand Down

0 comments on commit c4e9e6d

Please sign in to comment.