summaryrefslogtreecommitdiff
path: root/src/calcurse.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2014-07-17 11:47:00 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2014-07-17 12:03:34 +0200
commitae7d2d4c6b53160bfe0beae13dfb36b879451bba (patch)
tree9be18476f7ec7497b2e95643aa1af60f82b07eaf /src/calcurse.c
parent7920e761c9827cbd9d3fb47d663d90596da3c310 (diff)
downloadcalcurse-ae7d2d4c6b53160bfe0beae13dfb36b879451bba.zip
Only run the merge tool on files with differences
If the backup file and the data file are equal, there is no need to run the merge tool. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/calcurse.c')
-rw-r--r--src/calcurse.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/calcurse.c b/src/calcurse.c
index e31770c..8ba25ed 100644
--- a/src/calcurse.c
+++ b/src/calcurse.c
@@ -290,13 +290,21 @@ static inline void key_generic_reload(void)
io_save_todo(path_todo_backup);
io_save_mutex_unlock();
- const char *arg_apts[] = { conf.mergetool, path_apts,
- path_apts_backup, NULL };
- wins_launch_external(arg_apts);
-
- const char *arg_todo[] = { conf.mergetool, path_todo,
- path_todo_backup, NULL };
- wins_launch_external(arg_todo);
+ if (!io_files_equal(path_apts, path_apts_backup)) {
+ const char *arg_apts[] = { conf.mergetool,
+ path_apts,
+ path_apts_backup,
+ NULL };
+ wins_launch_external(arg_apts);
+ }
+
+ if (!io_files_equal(path_todo, path_todo_backup)) {
+ const char *arg_todo[] = { conf.mergetool,
+ path_todo,
+ path_todo_backup,
+ NULL };
+ wins_launch_external(arg_todo);
+ }
xfree(path_apts_backup);
xfree(path_todo_backup);