Merge branch 'ep/fix-test-lib-functions-report'
[gitweb.git] / builtin / commit.c
index 714638c5d625f370ce87f26b55375f874290ed95..da79ac4bc7a7247017e2f952b35642a1976c8101 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
 };
 
@@ -229,7 +229,7 @@ static int commit_index_files(void)
 static int list_paths(struct string_list *list, const char *with_tree,
                      const char *prefix, const struct pathspec *pattern)
 {
-       int i;
+       int i, ret;
        char *m;
 
        if (!pattern->nr)
@@ -256,7 +256,9 @@ static int list_paths(struct string_list *list, const char *with_tree,
                        item->util = item; /* better a valid pointer than a fake one */
        }
 
-       return report_path_error(m, pattern, prefix);
+       ret = report_path_error(m, pattern, prefix);
+       free(m);
+       return ret;
 }
 
 static void add_remove_files(struct string_list *list)
@@ -1766,8 +1768,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);