@matheusbsbs / matheus-bagliano / commits / 9153983310
Fork 0

Log message printout cleanups

On Sun, 16 Apr 2006, Junio C Hamano wrote: > > In the mid-term, I am hoping we can drop the generate_header() > callchain _and_ the custom code that formats commit log in-core, > found in cmd_log_wc(). Ok, this was nastier than expected, just because the dependencies between the different log-printing stuff were absolutely _everywhere_, but here's a patch that does exactly that. The patch is not very easy to read, and the "--patch-with-stat" thing is still broken (it does not call the "show_log()" thing properly for merges). That's not a new bug. In the new world order it _should_ do something like if (rev->logopt) show_log(rev, rev->logopt, "---\n"); but it doesn't. I haven't looked at the --with-stat logic, so I left it alone. That said, this patch removes more lines than it adds, and in particular, the "cmd_log_wc()" loop is now a very clean: while ((commit = get_revision(rev)) != NULL) { log_tree_commit(rev, commit); free(commit->buffer); commit->buffer = NULL; } so it doesn't get much prettier than this. All the complexity is entirely hidden in log-tree.c, and any code that needs to flush the log literally just needs to do the "if (rev->logopt) show_log(...)" incantation. I had to make the combined_diff() logic take a "struct rev_info" instead of just a "struct diff_options", but that part is pretty clean. This does change "git whatchanged" from using "diff-tree" as the commit descriptor to "commit", and I changed one of the tests to reflect that new reality. Otherwise everything still passes, and my other tests look fine too. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Apr 17, 2006 at 11:59 UTC 9153983310a169a340bd1023dccafd80b70b05bc
11 files changed +151 -185
combine-diff.c
+21 -26
@@ -5,6 +5,7 @@
5 #include "diffcore.h"
6 #include "quote.h"
7 #include "xdiff-interface.h"
8 +#include "log-tree.h"
9
10 static int uninteresting(struct diff_filepair *p)
11 {
@@ -585,9 +586,9 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
586 }
587
588 static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
588 - int dense, const char *header,
589 - struct diff_options *opt)
589 + int dense, struct rev_info *rev)
590 {
591 + struct diff_options *opt = &rev->diffopt;
592 unsigned long result_size, cnt, lno;
593 char *result, *cp, *ep;
594 struct sline *sline; /* survived lines */
@@ -689,10 +690,8 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
690 if (show_hunks || mode_differs || working_tree_file) {
691 const char *abb;
692
692 - if (header) {
693 - shown_header++;
694 - printf("%s%c", header, opt->line_termination);
695 - }
693 + if (rev->loginfo)
694 + show_log(rev, rev->loginfo, "\n");
695 printf("diff --%s ", dense ? "cc" : "combined");
696 if (quote_c_style(elem->path, NULL, NULL, 0))
697 quote_c_style(elem->path, NULL, stdout, 0);
@@ -750,8 +749,9 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
749
750 #define COLONS "::::::::::::::::::::::::::::::::"
751
753 -static void show_raw_diff(struct combine_diff_path *p, int num_parent, const char *header, struct diff_options *opt)
752 +static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
753 {
754 + struct diff_options *opt = &rev->diffopt;
755 int i, offset, mod_type = 'A';
756 const char *prefix;
757 int line_termination, inter_name_termination;
@@ -761,8 +761,8 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha
761 if (!line_termination)
762 inter_name_termination = 0;
763
764 - if (header)
765 - printf("%s%c", header, line_termination);
764 + if (rev->loginfo)
765 + show_log(rev, rev->loginfo, "\n");
766
767 for (i = 0; i < num_parent; i++) {
768 if (p->parent[i].mode)
@@ -810,31 +810,31 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha
810 }
811 }
812
813 -int show_combined_diff(struct combine_diff_path *p,
813 +void show_combined_diff(struct combine_diff_path *p,
814 int num_parent,
815 int dense,
816 - const char *header,
817 - struct diff_options *opt)
816 + struct rev_info *rev)
817 {
818 + struct diff_options *opt = &rev->diffopt;
819 if (!p->len)
820 - return 0;
820 + return;
821 switch (opt->output_format) {
822 case DIFF_FORMAT_RAW:
823 case DIFF_FORMAT_NAME_STATUS:
824 case DIFF_FORMAT_NAME:
825 - show_raw_diff(p, num_parent, header, opt);
826 - return 1;
825 + show_raw_diff(p, num_parent, rev);
826 + return;
827
828 default:
829 case DIFF_FORMAT_PATCH:
830 - return show_patch_diff(p, num_parent, dense, header, opt);
830 + show_patch_diff(p, num_parent, dense, rev);
831 }
832 }
833
834 -const char *diff_tree_combined_merge(const unsigned char *sha1,
835 - const char *header, int dense,
836 - struct diff_options *opt)
834 +void diff_tree_combined_merge(const unsigned char *sha1,
835 + int dense, struct rev_info *rev)
836 {
837 + struct diff_options *opt = &rev->diffopt;
838 struct commit *commit = lookup_commit(sha1);
839 struct diff_options diffopts;
840 struct commit_list *parents;
@@ -874,17 +874,13 @@ const char *diff_tree_combined_merge(const unsigned char *sha1,
874 int saved_format = opt->output_format;
875 opt->output_format = DIFF_FORMAT_RAW;
876 for (p = paths; p; p = p->next) {
877 - if (show_combined_diff(p, num_parent, dense,
878 - header, opt))
879 - header = NULL;
877 + show_combined_diff(p, num_parent, dense, rev);
878 }
879 opt->output_format = saved_format;
880 putchar(opt->line_termination);
881 }
882 for (p = paths; p; p = p->next) {
885 - if (show_combined_diff(p, num_parent, dense,
886 - header, opt))
887 - header = NULL;
883 + show_combined_diff(p, num_parent, dense, rev);
884 }
885 }
886
@@ -894,5 +890,4 @@ const char *diff_tree_combined_merge(const unsigned char *sha1,
890 paths = paths->next;
891 free(tmp);
892 }
897 - return header;
893 }
diff-files.c
+14 -13
@@ -5,12 +5,14 @@
5 */
6 #include "cache.h"
7 #include "diff.h"
8 +#include "commit.h"
9 +#include "revision.h"
10
11 static const char diff_files_usage[] =
12 "git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
13 COMMON_DIFF_OPTIONS_HELP;
14
13 -static struct diff_options diff_options;
15 +static struct rev_info rev;
16 static int silent = 0;
17 static int diff_unmerged_stage = 2;
18 static int combine_merges = 0;
@@ -18,12 +20,12 @@ static int dense_combined_merges = 0;
20
21 static void show_unmerge(const char *path)
22 {
21 - diff_unmerge(&diff_options, path);
23 + diff_unmerge(&rev.diffopt, path);
24 }
25
26 static void show_file(int pfx, struct cache_entry *ce)
27 {
26 - diff_addremove(&diff_options, pfx, ntohl(ce->ce_mode),
28 + diff_addremove(&rev.diffopt, pfx, ntohl(ce->ce_mode),
29 ce->sha1, ce->name, NULL);
30 }
31
@@ -31,7 +33,7 @@ static void show_modified(int oldmode, int mode,
33 const unsigned char *old_sha1, const unsigned char *sha1,
34 char *path)
35 {
34 - diff_change(&diff_options, oldmode, mode, old_sha1, sha1, path, NULL);
36 + diff_change(&rev.diffopt, oldmode, mode, old_sha1, sha1, path, NULL);
37 }
38
39 int main(int argc, const char **argv)
@@ -41,7 +43,7 @@ int main(int argc, const char **argv)
43 int entries, i;
44
45 git_config(git_diff_config);
44 - diff_setup(&diff_options);
46 + diff_setup(&rev.diffopt);
47 while (1 < argc && argv[1][0] == '-') {
48 if (!strcmp(argv[1], "--")) {
49 argv++;
@@ -74,7 +76,7 @@ int main(int argc, const char **argv)
76 dense_combined_merges = combine_merges = 1;
77 else {
78 int diff_opt_cnt;
77 - diff_opt_cnt = diff_opt_parse(&diff_options,
79 + diff_opt_cnt = diff_opt_parse(&rev.diffopt,
80 argv+1, argc-1);
81 if (diff_opt_cnt < 0)
82 usage(diff_files_usage);
@@ -89,13 +91,13 @@ int main(int argc, const char **argv)
91 argv++; argc--;
92 }
93 if (dense_combined_merges)
92 - diff_options.output_format = DIFF_FORMAT_PATCH;
94 + rev.diffopt.output_format = DIFF_FORMAT_PATCH;
95
96 /* Find the directory, and set up the pathspec */
97 pathspec = get_pathspec(prefix, argv + 1);
98 entries = read_cache();
99
98 - if (diff_setup_done(&diff_options) < 0)
100 + if (diff_setup_done(&rev.diffopt) < 0)
101 usage(diff_files_usage);
102
103 /* At this point, if argc == 1, then we are doing everything.
@@ -167,8 +169,7 @@ int main(int argc, const char **argv)
169 if (combine_merges && num_compare_stages == 2) {
170 show_combined_diff(&combine.p, 2,
171 dense_combined_merges,
170 - NULL,
171 - &diff_options);
172 + &rev);
173 free(combine.p.path);
174 continue;
175 }
@@ -194,7 +195,7 @@ int main(int argc, const char **argv)
195 continue;
196 }
197 changed = ce_match_stat(ce, &st, 0);
197 - if (!changed && !diff_options.find_copies_harder)
198 + if (!changed && !rev.diffopt.find_copies_harder)
199 continue;
200 oldmode = ntohl(ce->ce_mode);
201
@@ -207,7 +208,7 @@ int main(int argc, const char **argv)
208 ce->sha1, (changed ? null_sha1 : ce->sha1),
209 ce->name);
210 }
210 - diffcore_std(&diff_options);
211 - diff_flush(&diff_options);
211 + diffcore_std(&rev.diffopt);
212 + diff_flush(&rev.diffopt);
213 return 0;
214 }
diff-tree.c
+1
@@ -71,6 +71,7 @@ int main(int argc, const char **argv)
71 nr_sha1 = 0;
72 init_revisions(opt);
73 opt->abbrev = 0;
74 + opt->diff = 1;
75 argc = setup_revisions(argc, argv, opt, NULL);
76
77 while (--argc > 0) {
diff.h
+4 -4
@@ -6,6 +6,7 @@
6
7 #include "tree-walk.h"
8
9 +struct rev_info;
10 struct diff_options;
11
12 typedef void (*change_fn_t)(struct diff_options *options,
@@ -70,11 +71,10 @@ struct combine_diff_path {
71 (sizeof(struct combine_diff_path) + \
72 sizeof(struct combine_diff_parent) * (n) + (l) + 1)
73
73 -extern int show_combined_diff(struct combine_diff_path *elem, int num_parent,
74 - int dense, const char *header,
75 - struct diff_options *);
74 +extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
75 + int dense, struct rev_info *);
76
77 -extern const char *diff_tree_combined_merge(const unsigned char *sha1, const char *, int, struct diff_options *opt);
77 +extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
78
79 extern void diff_addremove(struct diff_options *,
80 int addremove,
git.c
+2 -55
@@ -282,75 +282,22 @@ static int cmd_log_wc(int argc, const char **argv, char **envp,
282 struct rev_info *rev)
283 {
284 struct commit *commit;
285 - char *buf = xmalloc(LOGSIZE);
286 - const char *commit_prefix = "commit ";
287 - int shown = 0;
285
286 rev->abbrev = DEFAULT_ABBREV;
287 rev->commit_format = CMIT_FMT_DEFAULT;
288 + rev->verbose_header = 1;
289 argc = setup_revisions(argc, argv, rev, "HEAD");
290
291 if (argc > 1)
292 die("unrecognized argument: %s", argv[1]);
295 - if (rev->commit_format == CMIT_FMT_ONELINE)
296 - commit_prefix = "";
293
294 prepare_revision_walk(rev);
295 setup_pager();
296 while ((commit = get_revision(rev)) != NULL) {
301 - unsigned long ofs = 0;
302 -
303 - if (shown && rev->diff &&
304 - rev->commit_format != CMIT_FMT_ONELINE)
305 - putchar('\n');
306 -
307 - ofs = sprintf(buf, "%s", commit_prefix);
308 - if (rev->abbrev_commit && rev->abbrev)
309 - ofs += sprintf(buf + ofs, "%s",
310 - find_unique_abbrev(commit->object.sha1,
311 - rev->abbrev));
312 - else
313 - ofs += sprintf(buf + ofs, "%s",
314 - sha1_to_hex(commit->object.sha1));
315 - if (rev->parents) {
316 - struct commit_list *parents = commit->parents;
317 - while (parents) {
318 - struct object *o = &(parents->item->object);
319 - parents = parents->next;
320 - if (o->flags & TMP_MARK)
321 - continue;
322 - ofs += sprintf(buf + ofs, " %s",
323 - sha1_to_hex(o->sha1));
324 - o->flags |= TMP_MARK;
325 - }
326 - /* TMP_MARK is a general purpose flag that can
327 - * be used locally, but the user should clean
328 - * things up after it is done with them.
329 - */
330 - for (parents = commit->parents;
331 - parents;
332 - parents = parents->next)
333 - parents->item->object.flags &= ~TMP_MARK;
334 - }
335 - buf[ofs++] =
336 - (rev->commit_format == CMIT_FMT_ONELINE) ? ' ' : '\n';
337 - ofs += pretty_print_commit(rev->commit_format, commit, ~0,
338 - buf + ofs,
339 - LOGSIZE - ofs - 20,
340 - rev->abbrev);
341 -
342 - if (rev->diff) {
343 - rev->use_precomputed_header = buf;
344 - strcpy(buf + ofs, "\n---\n");
345 - log_tree_commit(rev, commit);
346 - }
347 - else
348 - printf("%s\n", buf);
349 - shown = 1;
297 + log_tree_commit(rev, commit);
298 free(commit->buffer);
299 commit->buffer = NULL;
300 }
353 - free(buf);
301 return 0;
302 }
303
log-tree.c
+93 -74
@@ -1,11 +1,51 @@
1 +
2 #include "cache.h"
3 #include "diff.h"
4 #include "commit.h"
5 #include "log-tree.h"
6
7 +void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
8 +{
9 + static char this_header[16384];
10 + struct commit *commit = log->commit, *parent = log->parent;
11 + int abbrev = opt->diffopt.abbrev;
12 + int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
13 + int len;
14 +
15 + opt->loginfo = NULL;
16 + if (!opt->verbose_header) {
17 + puts(sha1_to_hex(commit->object.sha1));
18 + return;
19 + }
20 +
21 + /*
22 + * Whitespace between commit messages, unless we are oneline
23 + */
24 + if (opt->shown_one && opt->commit_format != CMIT_FMT_ONELINE)
25 + putchar('\n');
26 + opt->shown_one = 1;
27 +
28 + /*
29 + * Print header line of header..
30 + */
31 + printf("%s%s",
32 + opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
33 + diff_unique_abbrev(commit->object.sha1, abbrev_commit));
34 + if (parent)
35 + printf(" (from %s)", diff_unique_abbrev(parent->object.sha1, abbrev_commit));
36 + putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
37 +
38 + /*
39 + * And then the pretty-printed message itself
40 + */
41 + len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev);
42 + printf("%s%s", this_header, sep);
43 +}
44 +
45 int log_tree_diff_flush(struct rev_info *opt)
46 {
47 diffcore_std(&opt->diffopt);
48 +
49 if (diff_queue_is_empty()) {
50 int saved_fmt = opt->diffopt.output_format;
51 opt->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
@@ -13,12 +53,9 @@ int log_tree_diff_flush(struct rev_info *opt)
53 opt->diffopt.output_format = saved_fmt;
54 return 0;
55 }
16 - if (opt->header) {
17 - if (!opt->no_commit_id)
18 - printf("%s%c", opt->header,
19 - opt->diffopt.line_termination);
20 - opt->header = NULL;
21 - }
56 +
57 + if (opt->loginfo && !opt->no_commit_id)
58 + show_log(opt, opt->loginfo, "\n");
59 diff_flush(&opt->diffopt);
60 return 1;
61 }
@@ -43,96 +80,78 @@ static int diff_root_tree(struct rev_info *opt,
80 return retval;
81 }
82
46 -static const char *get_header(struct rev_info *opt,
47 - const unsigned char *commit_sha1,
48 - const unsigned char *parent_sha1,
49 - const struct commit *commit)
50 -{
51 - static char this_header[16384];
52 - int offset;
53 - unsigned long len;
54 - int abbrev = opt->diffopt.abbrev;
55 - const char *msg = commit->buffer;
56 -
57 - if (opt->use_precomputed_header)
58 - return opt->use_precomputed_header;
59 -
60 - if (!opt->verbose_header)
61 - return sha1_to_hex(commit_sha1);
62 -
63 - len = strlen(msg);
64 -
65 - offset = sprintf(this_header, "%s%s ",
66 - opt->header_prefix,
67 - diff_unique_abbrev(commit_sha1, abbrev));
68 - if (commit_sha1 != parent_sha1)
69 - offset += sprintf(this_header + offset, "(from %s)\n",
70 - parent_sha1
71 - ? diff_unique_abbrev(parent_sha1, abbrev)
72 - : "root");
73 - else
74 - offset += sprintf(this_header + offset, "(from parents)\n");
75 - offset += pretty_print_commit(opt->commit_format, commit, len,
76 - this_header + offset,
77 - sizeof(this_header) - offset, abbrev);
78 - return this_header;
79 -}
80 -
81 -static const char *generate_header(struct rev_info *opt,
82 - const unsigned char *commit_sha1,
83 - const unsigned char *parent_sha1,
84 - const struct commit *commit)
85 -{
86 - const char *header = get_header(opt, commit_sha1, parent_sha1, commit);
87 -
88 - if (opt->always_show_header) {
89 - puts(header);
90 - header = NULL;
91 - }
92 - return header;
93 -}
94 -
83 static int do_diff_combined(struct rev_info *opt, struct commit *commit)
84 {
85 unsigned const char *sha1 = commit->object.sha1;
86
99 - opt->header = generate_header(opt, sha1, sha1, commit);
100 - opt->header = diff_tree_combined_merge(sha1, opt->header,
101 - opt->dense_combined_merges,
102 - &opt->diffopt);
103 - if (!opt->header && opt->verbose_header)
104 - opt->header_prefix = "\ndiff-tree ";
105 - return 0;
87 + diff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);
88 + return !opt->loginfo;
89 }
90
108 -int log_tree_commit(struct rev_info *opt, struct commit *commit)
91 +/*
92 + * Show the diff of a commit.
93 + *
94 + * Return true if we printed any log info messages
95 + */
96 +static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log_info *log)
97 {
98 + int showed_log;
99 struct commit_list *parents;
100 unsigned const char *sha1 = commit->object.sha1;
101
102 + if (!opt->diff)
103 + return 0;
104 +
105 /* Root commit? */
114 - if (opt->show_root_diff && !commit->parents) {
115 - opt->header = generate_header(opt, sha1, NULL, commit);
116 - diff_root_tree(opt, sha1, "");
106 + parents = commit->parents;
107 + if (!parents) {
108 + if (opt->show_root_diff)
109 + diff_root_tree(opt, sha1, "");
110 + return !opt->loginfo;
111 }
112
113 /* More than one parent? */
120 - if (commit->parents && commit->parents->next) {
114 + if (parents && parents->next) {
115 if (opt->ignore_merges)
116 return 0;
117 else if (opt->combine_merges)
118 return do_diff_combined(opt, commit);
119 +
120 + /* If we show individual diffs, show the parent info */
121 + log->parent = parents->item;
122 }
123
127 - for (parents = commit->parents; parents; parents = parents->next) {
124 + showed_log = 0;
125 + for (;;) {
126 struct commit *parent = parents->item;
129 - unsigned const char *psha1 = parent->object.sha1;
130 - opt->header = generate_header(opt, sha1, psha1, commit);
131 - diff_tree_sha1(psha1, sha1, "", &opt->diffopt);
132 - log_tree_diff_flush(opt);
127
134 - if (!opt->header && opt->verbose_header)
135 - opt->header_prefix = "\ndiff-tree ";
128 + diff_tree_sha1(parent->object.sha1, sha1, "", &opt->diffopt);
129 + log_tree_diff_flush(opt);
130 +
131 + showed_log |= !opt->loginfo;
132 +
133 + /* Set up the log info for the next parent, if any.. */
134 + parents = parents->next;
135 + if (!parents)
136 + break;
137 + log->parent = parents->item;
138 + opt->loginfo = log;
139 + }
140 + return showed_log;
141 +}
142 +
143 +int log_tree_commit(struct rev_info *opt, struct commit *commit)
144 +{
145 + struct log_info log;
146 +
147 + log.commit = commit;
148 + log.parent = NULL;
149 + opt->loginfo = &log;
150 +
151 + if (!log_tree_diff(opt, commit, &log) && opt->loginfo && opt->always_show_header) {
152 + log.parent = NULL;
153 + show_log(opt, opt->loginfo, "");
154 }
155 + opt->loginfo = NULL;
156 return 0;
157 }
log-tree.h
+5
@@ -3,9 +3,14 @@
3
4 #include "revision.h"
5
6 +struct log_info {
7 + struct commit *commit, *parent;
8 +};
9 +
10 void init_log_tree_opt(struct rev_info *);
11 int log_tree_diff_flush(struct rev_info *);
12 int log_tree_commit(struct rev_info *, struct commit *);
13 int log_tree_opt_parse(struct rev_info *, const char **, int);
14 +void show_log(struct rev_info *opt, struct log_info *log, const char *sep);
15
16 #endif
rev-list.c
+5 -4
@@ -41,13 +41,14 @@ struct rev_info revs;
41 static int bisect_list = 0;
42 static int show_timestamp = 0;
43 static int hdr_termination = 0;
44 +static const char *header_prefix;
45
46 static void show_commit(struct commit *commit)
47 {
48 if (show_timestamp)
49 printf("%lu ", commit->date);
49 - if (*revs.header_prefix)
50 - fputs(revs.header_prefix, stdout);
50 + if (header_prefix)
51 + fputs(header_prefix, stdout);
52 if (commit->object.flags & BOUNDARY)
53 putchar('-');
54 if (revs.abbrev_commit && revs.abbrev)
@@ -322,9 +323,9 @@ int main(int argc, const char **argv)
323 /* The command line has a --pretty */
324 hdr_termination = '\n';
325 if (revs.commit_format == CMIT_FMT_ONELINE)
325 - revs.header_prefix = "";
326 + header_prefix = "";
327 else
327 - revs.header_prefix = "commit ";
328 + header_prefix = "commit ";
329 }
330 else if (revs.verbose_header)
331 /* Only --header was specified */
revision.c
-3
@@ -498,7 +498,6 @@ void init_revisions(struct rev_info *revs)
498 revs->topo_setter = topo_sort_default_setter;
499 revs->topo_getter = topo_sort_default_getter;
500
501 - revs->header_prefix = "";
501 revs->commit_format = CMIT_FMT_DEFAULT;
502
503 diff_setup(&revs->diffopt);
@@ -675,12 +674,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
674 }
675 if (!strcmp(arg, "-v")) {
676 revs->verbose_header = 1;
678 - revs->header_prefix = "diff-tree ";
677 continue;
678 }
679 if (!strncmp(arg, "--pretty", 8)) {
680 revs->verbose_header = 1;
683 - revs->header_prefix = "diff-tree ";
681 revs->commit_format = get_commit_format(arg+8);
682 continue;
683 }
revision.h
+4 -4
@@ -10,6 +10,7 @@
10 #define ADDED (1u<<6) /* Parents already parsed and added? */
11
12 struct rev_info;
13 +struct log_info;
14
15 typedef void (prune_fn_t)(struct rev_info *revs, struct commit *commit);
16
@@ -51,12 +52,11 @@ struct rev_info {
52 always_show_header:1;
53
54 /* Format info */
54 - unsigned int abbrev_commit:1;
55 + unsigned int shown_one:1,
56 + abbrev_commit:1;
57 unsigned int abbrev;
58 enum cmit_fmt commit_format;
57 - const char *header_prefix;
58 - const char *header;
59 - const char *use_precomputed_header;
59 + struct log_info *loginfo;
60
61 /* special limits */
62 int max_count;
t/t1200-tutorial.sh
+2 -2
@@ -49,7 +49,7 @@ test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output'
49 #test_expect_success 'git-read-tree --reset HEAD' "git-read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git-update-index --refresh)\""
50
51 cat > whatchanged.expect << EOF
52 -diff-tree VARIABLE (from root)
52 +commit VARIABLE
53 Author: VARIABLE
54 Date: VARIABLE
55
@@ -72,7 +72,7 @@ index 0000000..557db03
72 EOF
73
74 git-whatchanged -p --root | \
75 - sed -e "1s/^\(.\{10\}\).\{40\}/\1VARIABLE/" \
75 + sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \
76 -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
77 > whatchanged.output
78 test_expect_success 'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output'