diff options
Diffstat (limited to 'src/actions')
| -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) + } } } } |
