diff options
| author | Mel <einebeere@gmail.com> | 2021-10-10 21:35:18 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-10 21:35:18 +0200 |
| commit | b7650c22dbb42a7eeb55d148610c893a74280369 (patch) | |
| tree | 1a0517f8bbca7dc7ed3a1c1988833d107f64d92c | |
| parent | e619e85ae4ce3765030728eb3190ce7605b58d43 (diff) | |
| download | ka-b7650c22dbb42a7eeb55d148610c893a74280369.tar.zst ka-b7650c22dbb42a7eeb55d148610c893a74280369.zip | |
Check if file changed on Update.
| -rw-r--r-- | src/actions/update.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/actions/update.rs b/src/actions/update.rs index a4a64b3..05379c1 100644 --- a/src/actions/update.rs +++ b/src/actions/update.rs @@ -97,15 +97,17 @@ fn get_new_history_for_file<FS: Fs>( let changes = ContentChange::diff(&old_content, &new_content); - // TODO: Check if file was changed. - - let mut new_history = file_history; - new_history.add_change(FileChange { - change_index: cursor + 1, - variant: FileChangeVariant::Updated(changes), - }); - - Ok(Some((history_file, new_history))) + if !changes.is_empty() { + let mut new_history = file_history; + new_history.add_change(FileChange { + change_index: cursor + 1, + variant: FileChangeVariant::Updated(changes), + }); + + Ok(Some((history_file, new_history))) + } else { + Ok(None) + } } } } |
