status: enable untracked cache
[gitweb.git] / builtin / commit.c
index 5cd1478ebfdae36a8112c7f93f9017b54954cf44..fe380a9b92cd7b4a301bfe0dba514319feda5832 100644 (file)
 #include "mailmap.h"
 
 static const char * const builtin_commit_usage[] = {
-       N_("git commit [options] [--] <pathspec>..."),
+       N_("git commit [<options>] [--] <pathspec>..."),
        NULL
 };
 
 static const char * const builtin_status_usage[] = {
-       N_("git status [options] [--] <pathspec>..."),
+       N_("git status [<options>] [--] <pathspec>..."),
        NULL
 };
 
@@ -1050,7 +1050,7 @@ static const char *find_author_by_nickname(const char *name)
                clear_mailmap(&mailmap);
                return strbuf_detach(&buf, NULL);
        }
-       die(_("No existing author found with '%s'"), name);
+       die(_("--author '%s' is not 'Name <email>' and matches no existing author"), name);
 }
 
 
@@ -1364,13 +1364,14 @@ int cmd_status(int argc, const char **argv, const char *prefix)
        refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, &s.pathspec, NULL, NULL);
 
        fd = hold_locked_index(&index_lock, 0);
-       if (0 <= fd)
-               update_index_if_able(&the_index, &index_lock);
 
        s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
        s.ignore_submodule_arg = ignore_submodule_arg;
        wt_status_collect(&s);
 
+       if (0 <= fd)
+               update_index_if_able(&the_index, &index_lock);
+
        if (s.relative_paths)
                s.prefix = prefix;
 
@@ -1766,8 +1767,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
        if (!transaction ||
            ref_transaction_update(transaction, "HEAD", sha1,
                                   current_head
-                                  ? current_head->object.sha1 : NULL,
-                                  0, !!current_head, sb.buf, &err) ||
+                                  ? current_head->object.sha1 : null_sha1,
+                                  0, sb.buf, &err) ||
            ref_transaction_commit(transaction, &err)) {
                rollback_index_files();
                die("%s", err.buf);