Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index dc9f21a9dc..df89996896 100644
--- a/diff.c
+++ b/diff.c
@@ -4723,11 +4723,26 @@ unsigned diff_filter_bit(char status)
int diff_check_follow_pathspec(struct pathspec *ps, int die_on_error)
{
+ unsigned forbidden_magic;
+
if (ps->nr != 1) {
if (die_on_error)
die(_("--follow requires exactly one pathspec"));
return 0;
}
+
+ forbidden_magic = ps->items[0].magic & ~(PATHSPEC_FROMTOP |
+ PATHSPEC_LITERAL);
+ if (forbidden_magic) {
+ if (die_on_error) {
+ struct strbuf sb = STRBUF_INIT;
+ pathspec_magic_names(forbidden_magic, &sb);
+ die(_("pathspec magic not supported by --follow: %s"),
+ sb.buf);
+ }
+ return 0;
+ }
+
return 1;
}