find deletion on pull
This commit is contained in:
@@ -70,7 +70,7 @@ pub fn clone(args: CloneArgs) {
|
||||
let depth = &args.depth.clone().unwrap_or(DEPTH.to_string());
|
||||
let (folders, files) = enumerate_remote(
|
||||
|a| req(&api_props, depth, a),
|
||||
&should_skip,
|
||||
None,
|
||||
EnumerateOptions {
|
||||
depth: Some(depth.to_owned()),
|
||||
relative_s: None
|
||||
@@ -107,10 +107,6 @@ fn save_blob(obj: ObjProps) {
|
||||
}
|
||||
}
|
||||
|
||||
fn should_skip(_: ObjProps) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
fn req(api_props: &ApiProps, depth: &str, relative_s: &str) -> Result<Vec<ObjProps>, ApiError> {
|
||||
ReqProps::new()
|
||||
.set_request(relative_s, &api_props)
|
||||
|
||||
@@ -12,6 +12,8 @@ pub fn remote_diff() {
|
||||
.unwrap()
|
||||
.strip_prefix(path::repo_root()).unwrap().to_path_buf();
|
||||
let (folders, files) = get_diff(relative_p);
|
||||
dbg!(files);
|
||||
return;
|
||||
|
||||
for folder in folders {
|
||||
println!("should pull {}", folder.clone().relative_s.unwrap());
|
||||
@@ -28,7 +30,7 @@ pub fn get_diff(path: PathBuf) -> (Vec<ObjProps>, Vec<ObjProps>) {
|
||||
|
||||
enumerate_remote(
|
||||
|a| req(&api_props, depth, a),
|
||||
&should_skip,
|
||||
Some(&should_skip),
|
||||
EnumerateOptions {
|
||||
depth: Some(depth.to_owned()),
|
||||
relative_s: Some(path.to_str().unwrap().to_owned())
|
||||
|
||||
@@ -32,6 +32,25 @@ pub enum State {
|
||||
// todo: relative path, filename
|
||||
// todo: not catch added empty folder
|
||||
pub fn status() {
|
||||
let mut all_hashes = get_all_objs_hashes();
|
||||
let staged_objs = get_staged(&mut all_hashes);
|
||||
|
||||
let objs: Vec<LocalObj> = all_hashes.iter().map(|x| {
|
||||
x.1.clone()
|
||||
}).collect();
|
||||
|
||||
|
||||
print_status(staged_objs, objs);
|
||||
}
|
||||
|
||||
pub fn get_all_objs() -> Vec<LocalObj> {
|
||||
let all_hashes = get_all_objs_hashes();
|
||||
all_hashes.iter().map(|x| {
|
||||
x.1.clone()
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn get_all_objs_hashes() -> HashMap<String, LocalObj> {
|
||||
let (mut new_objs_hashes, mut del_objs_hashes, objs_modified) = get_diff();
|
||||
let move_copy_hashes = get_move_copy_objs(&mut new_objs_hashes, &mut del_objs_hashes);
|
||||
|
||||
@@ -58,14 +77,7 @@ pub fn status() {
|
||||
all_hashes.extend(new_objs_hashes);
|
||||
all_hashes.extend(modified_objs_hashes);
|
||||
|
||||
let staged_objs = get_staged(&mut all_hashes);
|
||||
|
||||
let objs: Vec<LocalObj> = all_hashes.iter().map(|x| {
|
||||
x.1.clone()
|
||||
}).collect();
|
||||
|
||||
|
||||
print_status(staged_objs, objs);
|
||||
all_hashes
|
||||
}
|
||||
|
||||
fn should_retain(hasher: &mut Sha1, key: String, obj: LocalObj, move_copy_hashes: &mut HashMap<String, LocalObj>, del_objs_h: &mut HashMap<String, LocalObj>) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user