2 * Builtin "git log" and related commands (show, whatchanged)
4 * (C) Copyright 2006 Linus Torvalds
13 static int cmd_log_wc(int argc
, const char **argv
, char **envp
,
16 struct commit
*commit
;
18 rev
->abbrev
= DEFAULT_ABBREV
;
19 rev
->commit_format
= CMIT_FMT_DEFAULT
;
20 rev
->verbose_header
= 1;
21 argc
= setup_revisions(argc
, argv
, rev
, "HEAD");
22 if (rev
->always_show_header
) {
23 if (rev
->diffopt
.pickaxe
|| rev
->diffopt
.filter
) {
24 rev
->always_show_header
= 0;
25 if (rev
->diffopt
.output_format
== DIFF_FORMAT_RAW
)
26 rev
->diffopt
.output_format
= DIFF_FORMAT_NO_OUTPUT
;
31 die("unrecognized argument: %s", argv
[1]);
33 prepare_revision_walk(rev
);
35 while ((commit
= get_revision(rev
)) != NULL
) {
36 log_tree_commit(rev
, commit
);
38 commit
->buffer
= NULL
;
43 int cmd_whatchanged(int argc
, const char **argv
, char **envp
)
49 rev
.diffopt
.recursive
= 1;
50 return cmd_log_wc(argc
, argv
, envp
, &rev
);
53 int cmd_show(int argc
, const char **argv
, char **envp
)
59 rev
.diffopt
.recursive
= 1;
60 rev
.combine_merges
= 1;
61 rev
.dense_combined_merges
= 1;
62 rev
.always_show_header
= 1;
63 rev
.ignore_merges
= 0;
65 return cmd_log_wc(argc
, argv
, envp
, &rev
);
68 int cmd_log(int argc
, const char **argv
, char **envp
)
73 rev
.always_show_header
= 1;
74 rev
.diffopt
.recursive
= 1;
75 return cmd_log_wc(argc
, argv
, envp
, &rev
);