summaryrefslogtreecommitdiffstats
path: root/diff.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-06-01 19:41:06 +0200
committerJunio C Hamano <gitster@pobox.com>2023-06-03 03:34:25 +0200
commit9eac5954e81037f282ace2efff7110af3440dc19 (patch)
treeea75389ce1c5dad909ab1488171bfdf7f9ff0f48 /diff.h
parentpathspec: factor out magic-to-name function (diff)
downloadgit-9eac5954e81037f282ace2efff7110af3440dc19.tar.xz
git-9eac5954e81037f282ace2efff7110af3440dc19.zip
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 'diff.h')
-rw-r--r--diff.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/diff.h b/diff.h
index 8d770b1d57..31e7db9ab0 100644
--- a/diff.h
+++ b/diff.h
@@ -542,6 +542,13 @@ void repo_diff_setup(struct repository *, struct diff_options *);
struct option *add_diff_options(const struct option *, struct diff_options *);
int diff_opt_parse(struct diff_options *, const char **, int, const char *);
void diff_setup_done(struct diff_options *);
+
+/*
+ * Returns true if the pathspec can work with --follow mode. If die_on_error is
+ * set, die() with a specific error message rather than returning false.
+ */
+int diff_check_follow_pathspec(struct pathspec *ps, int die_on_error);
+
int git_config_rename(const char *var, const char *value);
#define DIFF_DETECT_RENAME 1