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