]> git.ipfire.org Git - thirdparty/git.git/commit - diff.c
diff: factor out --follow pathspec check
authorJeff King <peff@peff.net>
Thu, 1 Jun 2023 17:41:06 +0000 (13:41 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 3 Jun 2023 01:34:25 +0000 (10:34 +0900)
commit9eac5954e81037f282ace2efff7110af3440dc19
treeea75389ce1c5dad909ab1488171bfdf7f9ff0f48
parent8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f
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>
builtin/log.c
diff.c
diff.h