Git 2.17.1
[gitweb.git] / builtin / add.c
index ac7c1c327766c6a729ab0377fd71c2f8e9042d00..9ef7fb02d56aac94d104b50aed7d7dfda09cfc98 100644 (file)
@@ -534,10 +534,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
        unplug_bulk_checkin();
 
 finish:
-       if (active_cache_changed) {
-               if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
-                       die(_("Unable to write new index file"));
-       }
+       if (write_locked_index(&the_index, &lock_file,
+                              COMMIT_LOCK | SKIP_IF_UNCHANGED))
+               die(_("Unable to write new index file"));
 
        UNLEAK(pathspec);
        UNLEAK(dir);