Skip to content

Commit b130c70

Browse files
committed
log: rename "tweak" helpers
The revision walking API allows the callers to tweak its configuration at the last minute, immediately after all the revision and pathspec parameters are parsed from the command line but before the default actions are decided based on them, by defining a "tweak" callback function when calling setup_revisions(). Traditionally, this facility was used by "git show" to turn on the patch output "-p" by default when no diff output option (e.g. "--raw" or "-s" to squelch the output altogether) is given on the command line, and further give dense combined diffs "--cc" for merge commits when no option to countermand it (e.g. "-m" to show pairwise patches). Recently, "git log" started using the same facility, but we named the callback function "default_follow_tweak()", as if the only kind of tweaking we would want for "git log" will forever be limited to turning "--follow" on by default when told by a configuration variable. That was myopic. Rename it to more generic name "log_setup_revisions_tweak()", and match the one used by show "show_setup_revisions_tweak()". Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ff86faf commit b130c70

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

builtin/log.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ static int show_tree_object(const unsigned char *sha1,
504504
return 0;
505505
}
506506

507-
static void show_rev_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)
507+
static void show_setup_revisions_tweak(struct rev_info *rev,
508+
struct setup_revision_opt *opt)
508509
{
509510
if (rev->ignore_merges) {
510511
/* There was no "-m" on the command line */
@@ -539,7 +540,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
539540

540541
memset(&opt, 0, sizeof(opt));
541542
opt.def = "HEAD";
542-
opt.tweak = show_rev_tweak_rev;
543+
opt.tweak = show_setup_revisions_tweak;
543544
cmd_log_init(argc, argv, prefix, &rev, &opt);
544545

545546
if (!rev.no_walk)
@@ -626,8 +627,8 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
626627
return cmd_log_walk(&rev);
627628
}
628629

629-
static void default_follow_tweak(struct rev_info *rev,
630-
struct setup_revision_opt *opt)
630+
static void log_setup_revisions_tweak(struct rev_info *rev,
631+
struct setup_revision_opt *opt)
631632
{
632633
if (DIFF_OPT_TST(&rev->diffopt, DEFAULT_FOLLOW_RENAMES) &&
633634
rev->prune_data.nr == 1)
@@ -647,7 +648,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
647648
memset(&opt, 0, sizeof(opt));
648649
opt.def = "HEAD";
649650
opt.revarg_opt = REVARG_COMMITTISH;
650-
opt.tweak = default_follow_tweak;
651+
opt.tweak = log_setup_revisions_tweak;
651652
cmd_log_init(argc, argv, prefix, &rev, &opt);
652653
return cmd_log_walk(&rev);
653654
}

0 commit comments

Comments
 (0)