mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-12-03 21:44:10 +01:00
Prevent sync data loss from incomplete tracked files (#725)
Co-authored-by: Zhizhen He <hezhizhen.yi@gmail.com>
This commit is contained in:
1 parent
b4417add33
commit
919e58fc9d
7 files changed
+419
-48
No files matched your search
@@ -135,7 +135,7 @@ pub fn git_status(dir: &Path) -> crate::error::Result<GitStatusSummary> {
|
||||
let obj = entry.to_object(&repo)?;
|
||||
let content = obj.as_blob().unwrap().content();
|
||||
let name = Path::new(entry.name().unwrap_or_default());
|
||||
SyncModel::from_bytes(content.into(), name)?.map(|m| m.0)
|
||||
SyncModel::from_bytes(content.into(), name).ok().flatten().map(|m| m.0)
|
||||
}
|
||||
Err(_) => None,
|
||||
},
|
||||
@@ -143,7 +143,7 @@ pub fn git_status(dir: &Path) -> crate::error::Result<GitStatusSummary> {
|
||||
|
||||
let next = {
|
||||
let full_path = repo.workdir().unwrap().join(rela_path.clone());
|
||||
SyncModel::from_file(full_path.as_path())?.map(|m| m.0)
|
||||
SyncModel::from_file(full_path.as_path()).ok().flatten().map(|m| m.0)
|
||||
};
|
||||
|
||||
entries.push(GitStatusEntry {
|
||||
|
||||
Reference in new issue
Block a user