summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: db89665)
raw | patch | inline | side by side (parent: db89665)
author | Linus Torvalds <torvalds@osdl.org> | |
Mon, 17 Apr 2006 18:59:32 +0000 (11:59 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 17 Apr 2006 22:18:25 +0000 (15:18 -0700) |
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>
>
> 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>
combine-diff.c | patch | blob | history | |
diff-files.c | patch | blob | history | |
diff-tree.c | patch | blob | history | |
diff.h | patch | blob | history | |
git.c | patch | blob | history | |
log-tree.c | patch | blob | history | |
log-tree.h | patch | blob | history | |
rev-list.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history | |
t/t1200-tutorial.sh | patch | blob | history |
diff --git a/combine-diff.c b/combine-diff.c
index 9bd27f82ec1d7c313987325a4948a5eed8c9b799..b4fa9c9f68bc814bd965db01bbbd7a1d8c2b6664 100644 (file)
--- a/combine-diff.c
+++ b/combine-diff.c
#include "diffcore.h"
#include "quote.h"
#include "xdiff-interface.h"
+#include "log-tree.h"
static int uninteresting(struct diff_filepair *p)
{
}
static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
- int dense, const char *header,
- struct diff_options *opt)
+ int dense, struct rev_info *rev)
{
+ struct diff_options *opt = &rev->diffopt;
unsigned long result_size, cnt, lno;
char *result, *cp, *ep;
struct sline *sline; /* survived lines */
if (show_hunks || mode_differs || working_tree_file) {
const char *abb;
- if (header) {
- shown_header++;
- printf("%s%c", header, opt->line_termination);
- }
+ if (rev->loginfo)
+ show_log(rev, rev->loginfo, "\n");
printf("diff --%s ", dense ? "cc" : "combined");
if (quote_c_style(elem->path, NULL, NULL, 0))
quote_c_style(elem->path, NULL, stdout, 0);
#define COLONS "::::::::::::::::::::::::::::::::"
-static void show_raw_diff(struct combine_diff_path *p, int num_parent, const char *header, struct diff_options *opt)
+static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
{
+ struct diff_options *opt = &rev->diffopt;
int i, offset, mod_type = 'A';
const char *prefix;
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
if (!line_termination)
inter_name_termination = 0;
- if (header)
- printf("%s%c", header, line_termination);
+ if (rev->loginfo)
+ show_log(rev, rev->loginfo, "\n");
for (i = 0; i < num_parent; i++) {
if (p->parent[i].mode)
@@ -810,31 +810,31 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha
}
}
-int show_combined_diff(struct combine_diff_path *p,
+void show_combined_diff(struct combine_diff_path *p,
int num_parent,
int dense,
- const char *header,
- struct diff_options *opt)
+ struct rev_info *rev)
{
+ struct diff_options *opt = &rev->diffopt;
if (!p->len)
- return 0;
+ return;
switch (opt->output_format) {
case DIFF_FORMAT_RAW:
case DIFF_FORMAT_NAME_STATUS:
case DIFF_FORMAT_NAME:
- show_raw_diff(p, num_parent, header, opt);
- return 1;
+ show_raw_diff(p, num_parent, rev);
+ return;
default:
case DIFF_FORMAT_PATCH:
- return show_patch_diff(p, num_parent, dense, header, opt);
+ show_patch_diff(p, num_parent, dense, rev);
}
}
-const char *diff_tree_combined_merge(const unsigned char *sha1,
- const char *header, int dense,
- struct diff_options *opt)
+void diff_tree_combined_merge(const unsigned char *sha1,
+ int dense, struct rev_info *rev)
{
+ struct diff_options *opt = &rev->diffopt;
struct commit *commit = lookup_commit(sha1);
struct diff_options diffopts;
struct commit_list *parents;
int saved_format = opt->output_format;
opt->output_format = DIFF_FORMAT_RAW;
for (p = paths; p; p = p->next) {
- if (show_combined_diff(p, num_parent, dense,
- header, opt))
- header = NULL;
+ show_combined_diff(p, num_parent, dense, rev);
}
opt->output_format = saved_format;
putchar(opt->line_termination);
}
for (p = paths; p; p = p->next) {
- if (show_combined_diff(p, num_parent, dense,
- header, opt))
- header = NULL;
+ show_combined_diff(p, num_parent, dense, rev);
}
}
paths = paths->next;
free(tmp);
}
- return header;
}
diff --git a/diff-files.c b/diff-files.c
index 3e7f5f105b19fd47fd8b3716617592ec2a60da47..ffbef48b2e05869a0a74ea7df53ee80106aa81b3 100644 (file)
--- a/diff-files.c
+++ b/diff-files.c
*/
#include "cache.h"
#include "diff.h"
+#include "commit.h"
+#include "revision.h"
static const char diff_files_usage[] =
"git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
COMMON_DIFF_OPTIONS_HELP;
-static struct diff_options diff_options;
+static struct rev_info rev;
static int silent = 0;
static int diff_unmerged_stage = 2;
static int combine_merges = 0;
static void show_unmerge(const char *path)
{
- diff_unmerge(&diff_options, path);
+ diff_unmerge(&rev.diffopt, path);
}
static void show_file(int pfx, struct cache_entry *ce)
{
- diff_addremove(&diff_options, pfx, ntohl(ce->ce_mode),
+ diff_addremove(&rev.diffopt, pfx, ntohl(ce->ce_mode),
ce->sha1, ce->name, NULL);
}
const unsigned char *old_sha1, const unsigned char *sha1,
char *path)
{
- diff_change(&diff_options, oldmode, mode, old_sha1, sha1, path, NULL);
+ diff_change(&rev.diffopt, oldmode, mode, old_sha1, sha1, path, NULL);
}
int main(int argc, const char **argv)
int entries, i;
git_config(git_diff_config);
- diff_setup(&diff_options);
+ diff_setup(&rev.diffopt);
while (1 < argc && argv[1][0] == '-') {
if (!strcmp(argv[1], "--")) {
argv++;
dense_combined_merges = combine_merges = 1;
else {
int diff_opt_cnt;
- diff_opt_cnt = diff_opt_parse(&diff_options,
+ diff_opt_cnt = diff_opt_parse(&rev.diffopt,
argv+1, argc-1);
if (diff_opt_cnt < 0)
usage(diff_files_usage);
argv++; argc--;
}
if (dense_combined_merges)
- diff_options.output_format = DIFF_FORMAT_PATCH;
+ rev.diffopt.output_format = DIFF_FORMAT_PATCH;
/* Find the directory, and set up the pathspec */
pathspec = get_pathspec(prefix, argv + 1);
entries = read_cache();
- if (diff_setup_done(&diff_options) < 0)
+ if (diff_setup_done(&rev.diffopt) < 0)
usage(diff_files_usage);
/* At this point, if argc == 1, then we are doing everything.
if (combine_merges && num_compare_stages == 2) {
show_combined_diff(&combine.p, 2,
dense_combined_merges,
- NULL,
- &diff_options);
+ &rev);
free(combine.p.path);
continue;
}
continue;
}
changed = ce_match_stat(ce, &st, 0);
- if (!changed && !diff_options.find_copies_harder)
+ if (!changed && !rev.diffopt.find_copies_harder)
continue;
oldmode = ntohl(ce->ce_mode);
ce->sha1, (changed ? null_sha1 : ce->sha1),
ce->name);
}
- diffcore_std(&diff_options);
- diff_flush(&diff_options);
+ diffcore_std(&rev.diffopt);
+ diff_flush(&rev.diffopt);
return 0;
}
diff --git a/diff-tree.c b/diff-tree.c
index e5787985373739dee8dd8874ea9f8f6ff073af27..7207867a74d0869c6a6b839c040321c843ee9c2f 100644 (file)
--- a/diff-tree.c
+++ b/diff-tree.c
nr_sha1 = 0;
init_revisions(opt);
opt->abbrev = 0;
+ opt->diff = 1;
argc = setup_revisions(argc, argv, opt, NULL);
while (--argc > 0) {
index f783baef14604678d1e638cc766bffdbdc43f691..52fff6643ffe375e18cab6c8a3af6d5c11c8cd6d 100644 (file)
--- a/diff.h
+++ b/diff.h
#include "tree-walk.h"
+struct rev_info;
struct diff_options;
typedef void (*change_fn_t)(struct diff_options *options,
(sizeof(struct combine_diff_path) + \
sizeof(struct combine_diff_parent) * (n) + (l) + 1)
-extern int show_combined_diff(struct combine_diff_path *elem, int num_parent,
- int dense, const char *header,
- struct diff_options *);
+extern void show_combined_diff(struct combine_diff_path *elem, int num_parent,
+ int dense, struct rev_info *);
-extern const char *diff_tree_combined_merge(const unsigned char *sha1, const char *, int, struct diff_options *opt);
+extern void diff_tree_combined_merge(const unsigned char *sha1, int, struct rev_info *);
extern void diff_addremove(struct diff_options *,
int addremove,
index fc4e4292781d0aab39abaede2e872fce557a434b..016fa30d37ed343609e5d3fd8ec43881de91f561 100644 (file)
--- a/git.c
+++ b/git.c
struct rev_info *rev)
{
struct commit *commit;
- char *buf = xmalloc(LOGSIZE);
- const char *commit_prefix = "commit ";
- int shown = 0;
rev->abbrev = DEFAULT_ABBREV;
rev->commit_format = CMIT_FMT_DEFAULT;
+ rev->verbose_header = 1;
argc = setup_revisions(argc, argv, rev, "HEAD");
if (argc > 1)
die("unrecognized argument: %s", argv[1]);
- if (rev->commit_format == CMIT_FMT_ONELINE)
- commit_prefix = "";
prepare_revision_walk(rev);
setup_pager();
while ((commit = get_revision(rev)) != NULL) {
- unsigned long ofs = 0;
-
- if (shown && rev->diff &&
- rev->commit_format != CMIT_FMT_ONELINE)
- putchar('\n');
-
- ofs = sprintf(buf, "%s", commit_prefix);
- if (rev->abbrev_commit && rev->abbrev)
- ofs += sprintf(buf + ofs, "%s",
- find_unique_abbrev(commit->object.sha1,
- rev->abbrev));
- else
- ofs += sprintf(buf + ofs, "%s",
- sha1_to_hex(commit->object.sha1));
- if (rev->parents) {
- struct commit_list *parents = commit->parents;
- while (parents) {
- struct object *o = &(parents->item->object);
- parents = parents->next;
- if (o->flags & TMP_MARK)
- continue;
- ofs += sprintf(buf + ofs, " %s",
- sha1_to_hex(o->sha1));
- o->flags |= TMP_MARK;
- }
- /* TMP_MARK is a general purpose flag that can
- * be used locally, but the user should clean
- * things up after it is done with them.
- */
- for (parents = commit->parents;
- parents;
- parents = parents->next)
- parents->item->object.flags &= ~TMP_MARK;
- }
- buf[ofs++] =
- (rev->commit_format == CMIT_FMT_ONELINE) ? ' ' : '\n';
- ofs += pretty_print_commit(rev->commit_format, commit, ~0,
- buf + ofs,
- LOGSIZE - ofs - 20,
- rev->abbrev);
-
- if (rev->diff) {
- rev->use_precomputed_header = buf;
- strcpy(buf + ofs, "\n---\n");
- log_tree_commit(rev, commit);
- }
- else
- printf("%s\n", buf);
- shown = 1;
+ log_tree_commit(rev, commit);
free(commit->buffer);
commit->buffer = NULL;
}
- free(buf);
return 0;
}
diff --git a/log-tree.c b/log-tree.c
index af36f702e16daace6781a3b044c456062692aad4..c0a44320223a4d868f397c1a2338f6a44a64fffb 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
+
#include "cache.h"
#include "diff.h"
#include "commit.h"
#include "log-tree.h"
+void show_log(struct rev_info *opt, struct log_info *log, const char *sep)
+{
+ static char this_header[16384];
+ struct commit *commit = log->commit, *parent = log->parent;
+ int abbrev = opt->diffopt.abbrev;
+ int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
+ int len;
+
+ opt->loginfo = NULL;
+ if (!opt->verbose_header) {
+ puts(sha1_to_hex(commit->object.sha1));
+ return;
+ }
+
+ /*
+ * Whitespace between commit messages, unless we are oneline
+ */
+ if (opt->shown_one && opt->commit_format != CMIT_FMT_ONELINE)
+ putchar('\n');
+ opt->shown_one = 1;
+
+ /*
+ * Print header line of header..
+ */
+ printf("%s%s",
+ opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
+ diff_unique_abbrev(commit->object.sha1, abbrev_commit));
+ if (parent)
+ printf(" (from %s)", diff_unique_abbrev(parent->object.sha1, abbrev_commit));
+ putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
+
+ /*
+ * And then the pretty-printed message itself
+ */
+ len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev);
+ printf("%s%s", this_header, sep);
+}
+
int log_tree_diff_flush(struct rev_info *opt)
{
diffcore_std(&opt->diffopt);
+
if (diff_queue_is_empty()) {
int saved_fmt = opt->diffopt.output_format;
opt->diffopt.output_format = DIFF_FORMAT_NO_OUTPUT;
opt->diffopt.output_format = saved_fmt;
return 0;
}
- if (opt->header) {
- if (!opt->no_commit_id)
- printf("%s%c", opt->header,
- opt->diffopt.line_termination);
- opt->header = NULL;
- }
+
+ if (opt->loginfo && !opt->no_commit_id)
+ show_log(opt, opt->loginfo, "\n");
diff_flush(&opt->diffopt);
return 1;
}
return retval;
}
-static const char *get_header(struct rev_info *opt,
- const unsigned char *commit_sha1,
- const unsigned char *parent_sha1,
- const struct commit *commit)
-{
- static char this_header[16384];
- int offset;
- unsigned long len;
- int abbrev = opt->diffopt.abbrev;
- const char *msg = commit->buffer;
-
- if (opt->use_precomputed_header)
- return opt->use_precomputed_header;
-
- if (!opt->verbose_header)
- return sha1_to_hex(commit_sha1);
-
- len = strlen(msg);
-
- offset = sprintf(this_header, "%s%s ",
- opt->header_prefix,
- diff_unique_abbrev(commit_sha1, abbrev));
- if (commit_sha1 != parent_sha1)
- offset += sprintf(this_header + offset, "(from %s)\n",
- parent_sha1
- ? diff_unique_abbrev(parent_sha1, abbrev)
- : "root");
- else
- offset += sprintf(this_header + offset, "(from parents)\n");
- offset += pretty_print_commit(opt->commit_format, commit, len,
- this_header + offset,
- sizeof(this_header) - offset, abbrev);
- return this_header;
-}
-
-static const char *generate_header(struct rev_info *opt,
- const unsigned char *commit_sha1,
- const unsigned char *parent_sha1,
- const struct commit *commit)
-{
- const char *header = get_header(opt, commit_sha1, parent_sha1, commit);
-
- if (opt->always_show_header) {
- puts(header);
- header = NULL;
- }
- return header;
-}
-
static int do_diff_combined(struct rev_info *opt, struct commit *commit)
{
unsigned const char *sha1 = commit->object.sha1;
- opt->header = generate_header(opt, sha1, sha1, commit);
- opt->header = diff_tree_combined_merge(sha1, opt->header,
- opt->dense_combined_merges,
- &opt->diffopt);
- if (!opt->header && opt->verbose_header)
- opt->header_prefix = "\ndiff-tree ";
- return 0;
+ diff_tree_combined_merge(sha1, opt->dense_combined_merges, opt);
+ return !opt->loginfo;
}
-int log_tree_commit(struct rev_info *opt, struct commit *commit)
+/*
+ * Show the diff of a commit.
+ *
+ * Return true if we printed any log info messages
+ */
+static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log_info *log)
{
+ int showed_log;
struct commit_list *parents;
unsigned const char *sha1 = commit->object.sha1;
+ if (!opt->diff)
+ return 0;
+
/* Root commit? */
- if (opt->show_root_diff && !commit->parents) {
- opt->header = generate_header(opt, sha1, NULL, commit);
- diff_root_tree(opt, sha1, "");
+ parents = commit->parents;
+ if (!parents) {
+ if (opt->show_root_diff)
+ diff_root_tree(opt, sha1, "");
+ return !opt->loginfo;
}
/* More than one parent? */
- if (commit->parents && commit->parents->next) {
+ if (parents && parents->next) {
if (opt->ignore_merges)
return 0;
else if (opt->combine_merges)
return do_diff_combined(opt, commit);
+
+ /* If we show individual diffs, show the parent info */
+ log->parent = parents->item;
}
- for (parents = commit->parents; parents; parents = parents->next) {
+ showed_log = 0;
+ for (;;) {
struct commit *parent = parents->item;
- unsigned const char *psha1 = parent->object.sha1;
- opt->header = generate_header(opt, sha1, psha1, commit);
- diff_tree_sha1(psha1, sha1, "", &opt->diffopt);
- log_tree_diff_flush(opt);
- if (!opt->header && opt->verbose_header)
- opt->header_prefix = "\ndiff-tree ";
+ diff_tree_sha1(parent->object.sha1, sha1, "", &opt->diffopt);
+ log_tree_diff_flush(opt);
+
+ showed_log |= !opt->loginfo;
+
+ /* Set up the log info for the next parent, if any.. */
+ parents = parents->next;
+ if (!parents)
+ break;
+ log->parent = parents->item;
+ opt->loginfo = log;
+ }
+ return showed_log;
+}
+
+int log_tree_commit(struct rev_info *opt, struct commit *commit)
+{
+ struct log_info log;
+
+ log.commit = commit;
+ log.parent = NULL;
+ opt->loginfo = &log;
+
+ if (!log_tree_diff(opt, commit, &log) && opt->loginfo && opt->always_show_header) {
+ log.parent = NULL;
+ show_log(opt, opt->loginfo, "");
}
+ opt->loginfo = NULL;
return 0;
}
diff --git a/log-tree.h b/log-tree.h
index 91a909be73130b8542ed9092e120084bb263105b..a26e4841ff9f568f8536f286e3fc40f09b9dff3b 100644 (file)
--- a/log-tree.h
+++ b/log-tree.h
#include "revision.h"
+struct log_info {
+ struct commit *commit, *parent;
+};
+
void init_log_tree_opt(struct rev_info *);
int log_tree_diff_flush(struct rev_info *);
int log_tree_commit(struct rev_info *, struct commit *);
int log_tree_opt_parse(struct rev_info *, const char **, int);
+void show_log(struct rev_info *opt, struct log_info *log, const char *sep);
#endif
diff --git a/rev-list.c b/rev-list.c
index d3c0dd90e3cb94b253189b4968141b771caeabf5..a4d72af6e01d88aa41962736d9a52f58bf65aad7 100644 (file)
--- a/rev-list.c
+++ b/rev-list.c
static int bisect_list = 0;
static int show_timestamp = 0;
static int hdr_termination = 0;
+static const char *header_prefix;
static void show_commit(struct commit *commit)
{
if (show_timestamp)
printf("%lu ", commit->date);
- if (*revs.header_prefix)
- fputs(revs.header_prefix, stdout);
+ if (header_prefix)
+ fputs(header_prefix, stdout);
if (commit->object.flags & BOUNDARY)
putchar('-');
if (revs.abbrev_commit && revs.abbrev)
/* The command line has a --pretty */
hdr_termination = '\n';
if (revs.commit_format == CMIT_FMT_ONELINE)
- revs.header_prefix = "";
+ header_prefix = "";
else
- revs.header_prefix = "commit ";
+ header_prefix = "commit ";
}
else if (revs.verbose_header)
/* Only --header was specified */
diff --git a/revision.c b/revision.c
index f8fb02885589e3243b4b44692594861f98843d69..5abec18bc1ce161a2964dfa89f967ec7a0ec2fde 100644 (file)
--- a/revision.c
+++ b/revision.c
revs->topo_setter = topo_sort_default_setter;
revs->topo_getter = topo_sort_default_getter;
- revs->header_prefix = "";
revs->commit_format = CMIT_FMT_DEFAULT;
diff_setup(&revs->diffopt);
@@ -675,12 +674,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
}
if (!strcmp(arg, "-v")) {
revs->verbose_header = 1;
- revs->header_prefix = "diff-tree ";
continue;
}
if (!strncmp(arg, "--pretty", 8)) {
revs->verbose_header = 1;
- revs->header_prefix = "diff-tree ";
revs->commit_format = get_commit_format(arg+8);
continue;
}
diff --git a/revision.h b/revision.h
index 74dc5ef179e9778b874ceee7aefc6162892b116a..05f658a214a7e1ca7e009c0de9667bf66552dc47 100644 (file)
--- a/revision.h
+++ b/revision.h
#define ADDED (1u<<6) /* Parents already parsed and added? */
struct rev_info;
+struct log_info;
typedef void (prune_fn_t)(struct rev_info *revs, struct commit *commit);
always_show_header:1;
/* Format info */
- unsigned int abbrev_commit:1;
+ unsigned int shown_one:1,
+ abbrev_commit:1;
unsigned int abbrev;
enum cmit_fmt commit_format;
- const char *header_prefix;
- const char *header;
- const char *use_precomputed_header;
+ struct log_info *loginfo;
/* special limits */
int max_count;
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index 10024133e3e69af0d14200d23c00d1ba7d1dbf74..16b3ea915776e976890dfc5a9a9748c92de2d3fb 100755 (executable)
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
#test_expect_success 'git-read-tree --reset HEAD' "git-read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git-update-index --refresh)\""
cat > whatchanged.expect << EOF
-diff-tree VARIABLE (from root)
+commit VARIABLE
Author: VARIABLE
Date: VARIABLE
EOF
git-whatchanged -p --root | \
- sed -e "1s/^\(.\{10\}\).\{40\}/\1VARIABLE/" \
+ sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \
-e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
> whatchanged.output
test_expect_success 'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output'