X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fcommit.c;h=a4e4966319651c03a3bb933795c502b24b2324d4;hb=a9f80f3dd4dc68ec6e9898805ccac2bb44c563ab;hp=017b8a5536804a4689aea0059f4d26467ad852af;hpb=daa81c4a4a48a76e542293c025972e6a870fec9b;p=git.git diff --git a/builtin/commit.c b/builtin/commit.c index 017b8a553..a4e496631 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -83,6 +83,7 @@ static enum { static char *cleanup_arg; static int use_editor = 1, initial_commit, in_merge, include_status = 1; +static int show_ignored_in_status; static const char *only_include_assumed; static struct strbuf message; @@ -461,15 +462,21 @@ static void determine_author_info(void) if (!a) die("invalid commit: %s", use_message); - lb = strstr(a + 8, " <"); - rb = strstr(a + 8, "> "); - eol = strchr(a + 8, '\n'); - if (!lb || !rb || !eol) + lb = strchrnul(a + strlen("\nauthor "), '<'); + rb = strchrnul(lb, '>'); + eol = strchrnul(rb, '\n'); + if (!*lb || !*rb || !*eol) die("invalid commit: %s", use_message); - name = xstrndup(a + 8, lb - (a + 8)); - email = xstrndup(lb + 2, rb - (lb + 2)); - date = xstrndup(rb + 2, eol - (rb + 2)); + if (lb == a + strlen("\nauthor ")) + /* \nauthor */ + name = xcalloc(1, 1); + else + name = xmemdupz(a + strlen("\nauthor "), + (lb - strlen(" ") - + (a + strlen("\nauthor ")))); + email = xmemdupz(lb + strlen("<"), rb - (lb + strlen("<"))); + date = xmemdupz(rb + strlen("> "), eol - (rb + strlen("> "))); } if (force_author) { @@ -1038,6 +1045,8 @@ int cmd_status(int argc, const char **argv, const char *prefix) "mode", "show untracked files, optional modes: all, normal, no. (Default: all)", PARSE_OPT_OPTARG, NULL, (intptr_t)"all" }, + OPT_BOOLEAN(0, "ignored", &show_ignored_in_status, + "show ignored files"), OPT_END(), }; @@ -1051,7 +1060,8 @@ int cmd_status(int argc, const char **argv, const char *prefix) builtin_status_options, builtin_status_usage, 0); handle_untracked_files_arg(&s); - + if (show_ignored_in_status) + s.show_ignored_files = 1; if (*argv) s.pathspec = get_pathspec(prefix, argv);