cleaning warnings

This commit is contained in:
grimhilt
2023-08-27 22:57:05 +02:00
parent 863e3bd68a
commit a35c7b20d8
13 changed files with 16 additions and 50 deletions

View File

@@ -18,7 +18,6 @@ pub struct AddArgs<'a> {
// todo match deleted files
// todo match weird reg expression
// todo -A == .
pub fn add(args: AddArgs) {
// write all modification in the index
if args.all {
@@ -104,7 +103,6 @@ fn add_folder_content(path: PathBuf, added_files: &mut Vec<String>) {
}
}
}
}
fn write_all() {
@@ -114,6 +112,6 @@ fn write_all() {
.create(true)
.open(index::path()).expect("Cannot open index file");
for obj in objs {
writeln!(index_file, "{}", path_buf_to_string(obj.path.clone()));
let _ = writeln!(index_file, "{}", path_buf_to_string(obj.path.clone()));
}
}

View File

@@ -91,10 +91,10 @@ pub fn clone(args: CloneArgs) {
}
}
let downloader = Downloader::new()
Downloader::new()
.set_api_props(api_props.clone())
.set_files(files)
//.should_log()
.should_log()
.download(ref_path.clone(), Some(&save_blob));
}

View File

@@ -35,7 +35,7 @@ pub fn pull() {
}
}
let downloader = Downloader::new()
Downloader::new()
.set_api_props(get_api_props())
.set_files(files)
.should_log()

View File

@@ -96,7 +96,6 @@ impl PushFactory {
State::Moved => Box::new(Moved { obj }),
State::Copied => Box::new(Copied { obj }),
State::Default => todo!(),
_ => todo!(),
}
}

View File

@@ -12,8 +12,6 @@ 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());

View File

@@ -1,6 +1,6 @@
use std::fs::File;
use std::path::PathBuf;
use std::io::{self, Lines, BufReader};
use std::io::{Lines, BufReader};
use std::collections::HashMap;
use crypto::digest::Digest;
use crypto::sha1::Sha1;

View File

@@ -41,7 +41,7 @@ impl Copy {
self.api_builder.send().await
}
pub fn overwrite(&mut self, overwrite: bool) -> &mut Copy {
pub fn _overwrite(&mut self, overwrite: bool) -> &mut Copy {
self.api_builder.set_header("Overwrite", HeaderValue::from_str({
if overwrite { "T" } else { "F" }
}).unwrap());

View File

@@ -42,7 +42,7 @@ impl Downloader {
self
}
pub fn add_file(&mut self, file: ObjProps) -> &mut Downloader {
pub fn _add_file(&mut self, file: ObjProps) -> &mut Downloader {
self.files.push(file);
self
}

View File

@@ -41,7 +41,7 @@ impl Move {
self.api_builder.send().await
}
pub fn overwrite(&mut self, overwrite: bool) -> &mut Move {
pub fn _overwrite(&mut self, overwrite: bool) -> &mut Move {
self.api_builder.set_header("Overwrite", HeaderValue::from_str({
if overwrite { "T" } else { "F" }
}).unwrap());

View File

@@ -223,32 +223,3 @@ fn create_obj(name: String, content: &str) -> io::Result<()> {
Ok(())
}
// get the last time a blob synced with remote
pub fn get_timestamp(path_s: String) -> Option<i64> {
let mut obj_p = path::objects();
let (dir, res) = hash_obj(&path_s);
obj_p.push(dir);
obj_p.push(res);
match read::read_lines(obj_p) {
Ok(mut reader) => {
match reader.next() {
Some(Ok(line)) => {
let mut data = line.rsplit(' ');
if data.clone().count() >= 2 {
Some(data.nth_back(1).unwrap().parse::<i64>().unwrap())
} else {
None
}
},
_ => None,
}
},
Err(err) => {
eprintln!("error reading object: {}", err);
None
},
}
}

View File

@@ -113,7 +113,7 @@ impl Blob {
refs_p.push(dir);
if !refs_p.exists() {
fs::create_dir_all(refs_p.clone());
let _ = fs::create_dir_all(refs_p.clone());
}
refs_p.push(res);
refs_p

View File

@@ -1,5 +1,5 @@
use std::path::PathBuf;
use crate::{services::{req_props::{ObjProps, ReqProps}, api::ApiError}, store::object::{blob::Blob, Object}, commands::status::State};
use crate::{services::{req_props::ObjProps, api::ApiError}, store::object::{blob::Blob, Object}, commands::status::State};
use std::collections::HashMap;
use super::{path::{path_buf_to_string, self}, read};