Code

Merge branch 'jc/maint-limit-note-output'
authorJunio C Hamano <gitster@pobox.com>
Sat, 23 Jan 2010 00:08:01 +0000 (16:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Jan 2010 00:08:01 +0000 (16:08 -0800)
* jc/maint-limit-note-output:
  Fix "log --oneline" not to show notes
  Fix "log" family not to be too agressive about showing notes

1  2 
builtin-log.c
commit.h
pretty.c
revision.c

diff --combined builtin-log.c
index 41b6df490f7c52edbee880afa9070c1511cdf442,2cb292fa727222487b5fed7f6f4db2bcc4237f49..8d16832f7e9483f7903009459a72efc39e267c98
@@@ -58,6 -58,9 +58,9 @@@ static void cmd_log_init(int argc, cons
                usage(builtin_log_usage);
        argc = setup_revisions(argc, argv, rev, "HEAD");
  
+       if (!rev->show_notes_given && !rev->pretty_given)
+               rev->show_notes = 1;
        if (rev->diffopt.pickaxe || rev->diffopt.filter)
                rev->always_show_header = 0;
        if (DIFF_OPT_TST(&rev->diffopt, FOLLOW_RENAMES)) {
@@@ -567,7 -570,7 +570,7 @@@ static int reopen_stdout(struct commit 
  
        get_patch_filename(commit, rev->nr, fmt_patch_suffix, &filename);
  
 -      if (!DIFF_OPT_TST(&rev->diffopt, QUIET))
 +      if (!DIFF_OPT_TST(&rev->diffopt, QUICK))
                fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
  
        if (freopen(filename.buf, "w", stdout) == NULL)
diff --combined commit.h
index 24128d7a2a0007d5aee2543624f0297d77860ea6,2c0742b721fe1d4d78a7a63ed1c2ee1cf9c96ab8..3cf51665816abb5e5855c036f102019eded23bd6
+++ b/commit.h
@@@ -70,9 -70,11 +70,10 @@@ struct pretty_print_contex
        const char *after_subject;
        enum date_mode date_mode;
        int need_8bit_cte;
+       int show_notes;
        struct reflog_walk_info *reflog_info;
  };
  
 -extern int non_ascii(int);
  extern int has_non_ascii(const char *text);
  struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
  extern char *reencode_commit_message(const struct commit *commit,
diff --combined pretty.c
index 9001379a9dd93818e962ae73cdf85dc178804256,b2ee7fe9de2830dbc276b49d54a18d1130b751a2..d493cade26890d3e16ea072ced8e0f95679f5670
+++ b/pretty.c
@@@ -83,7 -83,7 +83,7 @@@ static int get_one_line(const char *msg
  }
  
  /* High bit set, or ISO-2022-INT */
 -int non_ascii(int ch)
 +static int non_ascii(int ch)
  {
        return !isascii(ch) || ch == '\033';
  }
@@@ -1094,7 -1094,7 +1094,7 @@@ void pretty_print_commit(enum cmit_fmt 
        if (fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)
                strbuf_addch(sb, '\n');
  
-       if (fmt != CMIT_FMT_ONELINE)
+       if (context->show_notes)
                get_commit_notes(commit, sb, encoding,
                                 NOTES_SHOW_HEADER | NOTES_INDENT);
  
diff --combined revision.c
index 25fa14d93e04531e8d1dde3d9ac8408670adf32a,34f9ab98d1872770ef4d54014c31ece6eb7c8c39..f3b82d97bc76fbf5cb29373971366723d4467384
@@@ -791,7 -791,7 +791,7 @@@ void init_revisions(struct rev_info *re
        revs->ignore_merges = 1;
        revs->simplify_history = 1;
        DIFF_OPT_SET(&revs->pruning, RECURSIVE);
 -      DIFF_OPT_SET(&revs->pruning, QUIET);
 +      DIFF_OPT_SET(&revs->pruning, QUICK);
        revs->pruning.add_remove = file_add_remove;
        revs->pruning.change = file_change;
        revs->lifo = 1;
@@@ -1161,13 -1161,22 +1161,22 @@@ static int handle_revision_opt(struct r
                revs->verbose_header = 1;
        } else if (!strcmp(arg, "--pretty")) {
                revs->verbose_header = 1;
+               revs->pretty_given = 1;
                get_commit_format(arg+8, revs);
        } else if (!prefixcmp(arg, "--pretty=") || !prefixcmp(arg, "--format=")) {
                revs->verbose_header = 1;
+               revs->pretty_given = 1;
                get_commit_format(arg+9, revs);
+       } else if (!strcmp(arg, "--show-notes")) {
+               revs->show_notes = 1;
+               revs->show_notes_given = 1;
+       } else if (!strcmp(arg, "--no-notes")) {
+               revs->show_notes = 0;
+               revs->show_notes_given = 1;
        } else if (!strcmp(arg, "--oneline")) {
                revs->verbose_header = 1;
                get_commit_format("oneline", revs);
+               revs->pretty_given = 1;
                revs->abbrev_commit = 1;
        } else if (!strcmp(arg, "--graph")) {
                revs->topo_order = 1;