Merge branch 'nd/commit-a-with-paths-msg-update'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:13 +0000 (16:41 +0900)
The message given when "git commit -a <paths>" errors out has been
updated.

* nd/commit-a-with-paths-msg-update:
commit: improve error message in "-a <paths>" case

1  2 
builtin/commit.c
diff --combined builtin/commit.c
index a138ff85b0b699575f4e4f19094fa245a987833d,48ddccaa3747006c55fffea7125ffdf5f5cb1cac..833ecb316a8fa5a8bef7bc5894c2f6d571c57427
@@@ -235,7 -235,7 +235,7 @@@ static int commit_index_files(void
   * and return the paths that match the given pattern in list.
   */
  static int list_paths(struct string_list *list, const char *with_tree,
 -                    const char *prefix, const struct pathspec *pattern)
 +                    const struct pathspec *pattern)
  {
        int i, ret;
        char *m;
                        item->util = item; /* better a valid pointer than a fake one */
        }
  
 -      ret = report_path_error(m, pattern, prefix);
 +      ret = report_path_error(m, pattern);
        free(m);
        return ret;
  }
@@@ -454,7 -454,7 +454,7 @@@ static const char *prepare_index(int ar
                        die(_("cannot do a partial commit during a cherry-pick."));
        }
  
 -      if (list_paths(&partial, !current_head ? NULL : "HEAD", prefix, &pathspec))
 +      if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
                exit(1);
  
        discard_cache();
@@@ -609,8 -609,7 +609,8 @@@ static void determine_author_info(struc
                set_ident_var(&date, strbuf_detach(&date_buf, NULL));
        }
  
 -      strbuf_addstr(author_ident, fmt_ident(name, email, date, IDENT_STRICT));
 +      strbuf_addstr(author_ident, fmt_ident(name, email, WANT_AUTHOR_IDENT, date,
 +                              IDENT_STRICT));
        assert_split_ident(&author, author_ident);
        export_one("GIT_AUTHOR_NAME", author.name_begin, author.name_end, 0);
        export_one("GIT_AUTHOR_EMAIL", author.mail_begin, author.mail_end, 0);
@@@ -1039,10 -1038,6 +1039,10 @@@ static void handle_untracked_files_arg(
                s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
        else if (!strcmp(untracked_files_arg, "all"))
                s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
 +      /*
 +       * Please update $__git_untracked_file_modes in
 +       * git-completion.bash when you add new options
 +       */
        else
                die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
  }
@@@ -1184,17 -1179,14 +1184,18 @@@ static int parse_and_validate_options(i
        else if (!strcmp(cleanup_arg, "scissors"))
                cleanup_mode = use_editor ? COMMIT_MSG_CLEANUP_SCISSORS :
                                            COMMIT_MSG_CLEANUP_SPACE;
 +      /*
 +       * Please update _git_commit() in git-completion.bash when you
 +       * add new options.
 +       */
        else
                die(_("Invalid cleanup mode %s"), cleanup_arg);
  
        handle_untracked_files_arg(s);
  
        if (all && argc > 0)
-               die(_("Paths with -a does not make sense."));
+               die(_("paths '%s ...' with -a does not make sense"),
+                   argv[0]);
  
        if (status_format != STATUS_FORMAT_NONE)
                dry_run = 1;