diff options
author | Jeff King <peff@peff.net> | 2023-06-01 20:41:06 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-03 04:34:25 +0300 |
commit | 9eac5954e81037f282ace2efff7110af3440dc19 (patch) | |
tree | ea75389ce1c5dad909ab1488171bfdf7f9ff0f48 /builtin/log.c | |
parent | 8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f (diff) |
diff: factor out --follow pathspec check
In --follow mode, we require exactly one pathspec. We check this
condition in two places:
- in diff_setup_done(), we complain if --follow is used with an
inapropriate pathspec
- in git-log's revision "tweak" function, we enable log.follow only if
the pathspec allows it
The duplication isn't a big deal right now, since the logic is so
simple. But in preparation for it becoming more complex, let's pull it
into a shared function.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/log.c')
-rw-r--r-- | builtin/log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/log.c b/builtin/log.c index a70fba198f..06e3a1a946 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -856,7 +856,7 @@ static void log_setup_revisions_tweak(struct rev_info *rev, struct setup_revision_opt *opt) { if (rev->diffopt.flags.default_follow_renames && - rev->prune_data.nr == 1) + diff_check_follow_pathspec(&rev->prune_data, 0)) rev->diffopt.flags.follow_renames = 1; if (rev->first_parent_only) |