-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tag support #62
base: master
Are you sure you want to change the base?
Add tag support #62
Changes from 1 commit
33bc92a
52b791e
5315bc7
e368a1c
478d4d3
9febba0
2fc4cdc
f687fb8
b776d8f
9acbc9f
638721c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,12 @@ pub fn all_push_entries_in_fetch_head(repo: &Repository, rsl: &RSL, ref_names: & | |
println!("ref_name: {:?}", ref_name); | ||
match repo.find_branch(&format!("origin/{}", ref_name), BranchType::Remote) { | ||
Ok(branch) => branch.get().target(), | ||
Err(_) => None, | ||
Err(_) => { | ||
match repo.find_reference(&format!("refs/tags/{}", ref_name)) { | ||
Ok(tag_ref) => tag_ref.target(), | ||
Err(_) => None | ||
} | ||
}, | ||
} | ||
}) | ||
.collect(); | ||
|
@@ -232,7 +237,8 @@ impl<'remote, 'repo> RSL<'remote, 'repo> { | |
let mut revwalk: Revwalk = self.repo.revwalk()?; | ||
revwalk.push(self.remote_head)?; | ||
let mut current = Some(self.remote_head); | ||
let ref_name = format!("refs/heads/{}", branch); | ||
let reference = git::get_ref_from_name(self.repo, branch).expect("failed to get ref"); | ||
let ref_name = reference.name().expect("failed to get ref name"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error handling There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
while current != None { | ||
if let Some(pe) = PushEntry::from_oid(self.repo, ¤t.unwrap())? { | ||
if pe.ref_name() == ref_name { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,9 +62,11 @@ sequential_test! { | |
do_work_on_branch(&context.local, "refs/heads/master"); | ||
tag_lightweight(&mut context.local, "v6.66"); | ||
|
||
assert_eq!((), git_rsl::secure_push_with_cleanup(&mut context.local, &RemoteName::new("origin"), &ReferenceName::new("v6.66")).expect("Could not run third push")); | ||
assert_eq!((), git_rsl::secure_push_with_cleanup(&mut context.local, &RemoteName::new("origin"), &ReferenceName::new("v6.66")).expect("Could not push tag")); | ||
let remote_tag = &context.remote.find_reference("refs/tags/v6.66").expect("reference not found"); | ||
assert!(remote_tag.is_tag()); | ||
|
||
assert_eq!((), git_rsl::secure_fetch_with_cleanup(&mut context.local, &RemoteName::new("origin"), &ReferenceName::new("v6.66")).expect("could not fetch tag")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrap lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space after let
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2fc4cdc