step fifty eight: download remote ref values
This commit is contained in:
parent
1b1af9fac1
commit
70a660e2f5
|
@ -3,10 +3,24 @@ use std::collections::HashMap;
|
||||||
#[path = "data.rs"]
|
#[path = "data.rs"]
|
||||||
mod data;
|
mod data;
|
||||||
|
|
||||||
|
static REMOTE_REFS_BASE: &'static str = "refs/heads/";
|
||||||
|
static LOCAL_REFS_BASE: &'static str = "refs/remote/";
|
||||||
|
|
||||||
pub fn fetch(path: String) {
|
pub fn fetch(path: String) {
|
||||||
println!("Will fetch the following refs:");
|
// Get refs from server
|
||||||
for (refname, _) in get_remote_refs(path, "refs/heads").iter() {
|
let refs = get_remote_refs(path, REMOTE_REFS_BASE);
|
||||||
println!("- {}", refname);
|
|
||||||
|
// Update local refs to match server
|
||||||
|
for (remote_name, value) in refs.iter() {
|
||||||
|
let refname = remote_name.trim_start_matches(REMOTE_REFS_BASE);
|
||||||
|
data::update_ref(
|
||||||
|
format!("{}/{}", LOCAL_REFS_BASE, refname),
|
||||||
|
data::RefValue {
|
||||||
|
symbolic: false,
|
||||||
|
value: value.clone(),
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue