Code

tag.h: Remove unused signature field
[git.git] / builtin-commit.c
index 33aa593c21b70cd29a54e7b8151d78e092cfad3a..83b7c353ed6e4ca99a9bfae041c41280d31122a7 100644 (file)
@@ -278,11 +278,13 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
         * We still need to refresh the index here.
         */
        if (!pathspec || !*pathspec) {
-               fd = hold_locked_index(&index_lock, 1);
+               fd = hold_locked_index(&index_lock, !is_status);
                refresh_cache(refresh_flags);
-               if (write_cache(fd, active_cache, active_nr) ||
-                   commit_locked_index(&index_lock))
-                       die("unable to write new_index file");
+               if (0 <= fd) {
+                       if (write_cache(fd, active_cache, active_nr) ||
+                           commit_locked_index(&index_lock))
+                               die("unable to write new_index file");
+               }
                commit_style = COMMIT_AS_IS;
                return get_index_file();
        }