allow not updating parent's date when cloning
This commit is contained in:
parent
5bc9ef0035
commit
2d4905f506
@ -68,7 +68,7 @@ impl PushChange for New {
|
||||
let lastmodified = prop.lastmodified.unwrap().timestamp_millis();
|
||||
|
||||
// update blob
|
||||
blob::add(obj.path.clone(), &lastmodified.to_string())?;
|
||||
blob::add(obj.path.clone(), &lastmodified.to_string(), true)?;
|
||||
|
||||
// remove index
|
||||
index::rm_line(obj.path.to_str().unwrap())?;
|
||||
|
@ -74,7 +74,7 @@ impl PushChange for NewDir {
|
||||
let lastmodified = prop.lastmodified.unwrap().timestamp_millis();
|
||||
|
||||
// update tree
|
||||
tree::add(obj.path.clone(), &lastmodified.to_string())?;
|
||||
tree::add(obj.path.clone(), &lastmodified.to_string(), true)?;
|
||||
|
||||
// remove index
|
||||
index::rm_line(obj.path.to_str().unwrap())?;
|
||||
|
@ -5,7 +5,7 @@ use crate::utils::path;
|
||||
use crate::store::head;
|
||||
use crate::store::object::{update_dates, parse_path, add_node, create_obj, rm_node};
|
||||
|
||||
pub fn add(path: PathBuf, date: &str) -> io::Result<()> {
|
||||
pub fn add(path: PathBuf, date: &str, up_parent: bool) -> io::Result<()> {
|
||||
let (line, hash, name) = parse_path(path.clone(), true);
|
||||
// add blob reference to parent
|
||||
if path.iter().count() == 1 {
|
||||
@ -22,7 +22,9 @@ pub fn add(path: PathBuf, date: &str) -> io::Result<()> {
|
||||
create_obj(hash, &content)?;
|
||||
|
||||
// update date for all parent
|
||||
if up_parent {
|
||||
update_dates(path, date)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use crate::utils::{read, path};
|
||||
use crate::store::head;
|
||||
use crate::store::object::{self, update_dates, parse_path, hash_obj, add_node, create_obj};
|
||||
|
||||
pub fn add(path: PathBuf, date: &str) -> io::Result<()> {
|
||||
pub fn add(path: PathBuf, date: &str, up_parent: bool) -> io::Result<()> {
|
||||
let (line, hash, name) = parse_path(path.clone(), false);
|
||||
|
||||
// add tree reference to parent
|
||||
@ -22,7 +22,9 @@ pub fn add(path: PathBuf, date: &str) -> io::Result<()> {
|
||||
create_obj(hash, &content)?;
|
||||
|
||||
// update date for all parent
|
||||
if up_parent {
|
||||
update_dates(path, date)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user