]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-commit.c
Add a test for git-add --ignore-errors
[git.git] / builtin-commit.c
index b41d4a3561d6fd4376c1520c3b7dd436674e8325..6a2f5c3d96be44591e170222b42e48241182f8ed 100644 (file)
@@ -90,7 +90,7 @@ static struct option builtin_commit_options[] = {
        OPT_CALLBACK('m', "message", &message, "MESSAGE", "specify commit message", opt_parse_m),
        OPT_STRING('c', "reedit-message", &edit_message, "COMMIT", "reuse and edit message from specified commit "),
        OPT_STRING('C', "reuse-message", &use_message, "COMMIT", "reuse message from specified commit"),
-       OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by: header"),
+       OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"),
        OPT_STRING('t', "template", &template_file, "FILE", "use specified template file"),
        OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
 
@@ -101,7 +101,7 @@ static struct option builtin_commit_options[] = {
        OPT_BOOLEAN('o', "only", &only, "commit only specified files"),
        OPT_BOOLEAN('n', "no-verify", &no_verify, "bypass pre-commit hook"),
        OPT_BOOLEAN(0, "amend", &amend, "amend previous commit"),
-       OPT_BOOLEAN(0, "untracked-files", &untracked_files, "show all untracked files"),
+       OPT_BOOLEAN('u', "untracked-files", &untracked_files, "show all untracked files"),
        OPT_BOOLEAN(0, "allow-empty", &allow_empty, "ok to record an empty change"),
        OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
 
@@ -175,10 +175,13 @@ static void add_remove_files(struct path_list *list)
 {
        int i;
        for (i = 0; i < list->nr; i++) {
+               struct stat st;
                struct path_list_item *p = &(list->items[i]);
-               if (file_exists(p->path))
-                       add_file_to_cache(p->path, 0);
-               else
+
+               if (!lstat(p->path, &st)) {
+                       if (add_to_cache(p->path, &st, 0))
+                               die("updating files failed");
+               } else
                        remove_file_from_cache(p->path);
        }
 }
@@ -243,7 +246,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix)
         */
        if (all || (also && pathspec && *pathspec)) {
                int fd = hold_locked_index(&index_lock, 1);
-               add_files_to_cache(0, also ? prefix : NULL, pathspec);
+               add_files_to_cache(also ? prefix : NULL, pathspec, 0);
                refresh_cache(REFRESH_QUIET);
                if (write_cache(fd, active_cache, active_nr) ||
                    close_lock_file(&index_lock))