зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/log-p-cc'
"git log --cc" did not show any patch, even though most of the time the user meant "git log --cc -p -m" to see patch output for commits with a single parent, and combined diff for merge commits. The command is taught to DWIM "--cc" (without "--raw" and other forms of output specification) to "--cc -p -m". * jc/log-p-cc: builtin/log.c: minor reformat log: show merge commit when --cc is given log: when --cc is given, default to -p unless told otherwise log: rename "tweak" helpers
This commit is contained in:
Коммит
2ba6183b0b
|
@ -342,8 +342,7 @@ static int cmd_log_walk(struct rev_info *rev)
|
|||
* retain that state information if replacing rev->diffopt in this loop
|
||||
*/
|
||||
while ((commit = get_revision(rev)) != NULL) {
|
||||
if (!log_tree_commit(rev, commit) &&
|
||||
rev->max_count >= 0)
|
||||
if (!log_tree_commit(rev, commit) && rev->max_count >= 0)
|
||||
/*
|
||||
* We decremented max_count in get_revision,
|
||||
* but we didn't actually show the commit.
|
||||
|
@ -504,7 +503,8 @@ static int show_tree_object(const unsigned char *sha1,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void show_rev_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
|
||||
static void show_setup_revisions_tweak(struct rev_info *rev,
|
||||
struct setup_revision_opt *opt)
|
||||
{
|
||||
if (rev->ignore_merges) {
|
||||
/* There was no "-m" on the command line */
|
||||
|
@ -539,7 +539,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
|||
|
||||
memset(&opt, 0, sizeof(opt));
|
||||
opt.def = "HEAD";
|
||||
opt.tweak = show_rev_tweak_rev;
|
||||
opt.tweak = show_setup_revisions_tweak;
|
||||
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
||||
|
||||
if (!rev.no_walk)
|
||||
|
@ -626,12 +626,20 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
|
|||
return cmd_log_walk(&rev);
|
||||
}
|
||||
|
||||
static void default_follow_tweak(struct rev_info *rev,
|
||||
struct setup_revision_opt *opt)
|
||||
static void log_setup_revisions_tweak(struct rev_info *rev,
|
||||
struct setup_revision_opt *opt)
|
||||
{
|
||||
if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) &&
|
||||
rev->prune_data.nr == 1)
|
||||
DIFF_OPT_SET(&rev->diffopt, FOLLOW_RENAMES);
|
||||
|
||||
/* Turn --cc/-c into -p --cc/-c when -p was not given */
|
||||
if (!rev->diffopt.output_format && rev->combine_merges)
|
||||
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||
|
||||
/* Turn -m on when --cc/-c was given */
|
||||
if (rev->combine_merges)
|
||||
rev->ignore_merges = 0;
|
||||
}
|
||||
|
||||
int cmd_log(int argc, const char **argv, const char *prefix)
|
||||
|
@ -647,7 +655,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
|
|||
memset(&opt, 0, sizeof(opt));
|
||||
opt.def = "HEAD";
|
||||
opt.revarg_opt = REVARG_COMMITTISH;
|
||||
opt.tweak = default_follow_tweak;
|
||||
opt.tweak = log_setup_revisions_tweak;
|
||||
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
||||
return cmd_log_walk(&rev);
|
||||
}
|
||||
|
@ -1455,8 +1463,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (ignore_if_in_upstream &&
|
||||
has_commit_patch_id(commit, &ids))
|
||||
if (ignore_if_in_upstream && has_commit_patch_id(commit, &ids))
|
||||
continue;
|
||||
|
||||
nr++;
|
||||
|
|
Загрузка…
Ссылка в новой задаче