aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-20 12:29:01 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-20 12:29:01 -0700
commit6d3e1f2e453f7473d4ab64ef378309958613c5d7 (patch)
tree93863beb9bc01b1bd47dd61e66cf54939cc34e0c /builtin
parent638924fec2189f3f20ebf5d0ff4cc34ee551dd39 (diff)
parent2e582df0e0f1589054674c8ed3391f240a37a6df (diff)
downloadgit-6d3e1f2e453f7473d4ab64ef378309958613c5d7.tar.gz
git-6d3e1f2e453f7473d4ab64ef378309958613c5d7.tar.xz
Merge branch 'mm/status-without-comment-char'
"git status" now omits the prefix to make its output a comment in a commit log editor, which is not necessary for human consumption. We may want to tighten the output to omit unnecessary trailing blank lines, but that does not have to be in the scope of this series. * mm/status-without-comment-char: t7508: avoid non-portable sed expression status: add missing blank line after list of "other" files tests: don't set status.displayCommentPrefix file-wide status: disable display of '#' comment prefix by default submodule summary: ignore --for-status option wt-status: use argv_array API builtin/stripspace.c: fix broken indentation
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c10
-rw-r--r--builtin/stripspace.c8
2 files changed, 14 insertions, 4 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 084d70fd4..d0d8bc1b3 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -598,6 +598,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
const char *hook_arg2 = NULL;
int ident_shown = 0;
int clean_message_contents = (cleanup_mode != CLEANUP_NONE);
+ int old_display_comment_prefix;
/* This checks and barfs if author is badly specified */
determine_author_info(author_ident);
@@ -695,6 +696,10 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
if (s->fp == NULL)
die_errno(_("could not open '%s'"), git_path(commit_editmsg));
+ /* Ignore status.displayCommentPrefix: we do need comments in COMMIT_EDITMSG. */
+ old_display_comment_prefix = s->display_comment_prefix;
+ s->display_comment_prefix = 1;
+
if (clean_message_contents)
stripspace(&sb, 0);
@@ -820,6 +825,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
*/
if (!commitable && whence != FROM_MERGE && !allow_empty &&
!(amend && is_a_merge(current_head))) {
+ s->display_comment_prefix = old_display_comment_prefix;
run_status(stdout, index_file, prefix, 0, s);
if (amend)
fputs(_(empty_amend_advice), stderr);
@@ -1186,6 +1192,10 @@ static int git_status_config(const char *k, const char *v, void *cb)
s->use_color = git_config_colorbool(k, v);
return 0;
}
+ if (!strcmp(k, "status.displaycommentprefix")) {
+ s->display_comment_prefix = git_config_bool(k, v);
+ return 0;
+ }
if (!prefixcmp(k, "status.color.") || !prefixcmp(k, "color.status.")) {
int slot = parse_status_slot(k, 13);
if (slot < 0)
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index e981dfb9f..1259ed708 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -89,11 +89,11 @@ int cmd_stripspace(int argc, const char **argv, const char *prefix)
if (argc == 2) {
if (!strcmp(argv[1], "-s") ||
- !strcmp(argv[1], "--strip-comments")) {
- strip_comments = 1;
+ !strcmp(argv[1], "--strip-comments")) {
+ strip_comments = 1;
} else if (!strcmp(argv[1], "-c") ||
- !strcmp(argv[1], "--comment-lines")) {
- mode = COMMENT_LINES;
+ !strcmp(argv[1], "--comment-lines")) {
+ mode = COMMENT_LINES;
} else {
mode = INVAL;
}