diff options
author | Jeff King <peff@peff.net> | 2023-06-01 19:38:14 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-06-03 03:34:25 +0200 |
commit | 8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f (patch) | |
tree | 9db5c7c6043c22b58da2bb43c59c3e307ff630bc /pathspec.h | |
parent | Git 2.40.1 (diff) | |
download | git-8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f.tar.xz git-8e32caaa783a3a6b1d94834ee6e2d21ac36ff39f.zip |
pathspec: factor out magic-to-name function
When we have unsupported magic in a pathspec (because a command or code
path does not support particular items), we list the unsupported ones in
an error message.
Let's factor out the code here that converts the bits back into their
human-readable names, so that it can be used from other callers, which
may want to provide more flexible error messages.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pathspec.h')
-rw-r--r-- | pathspec.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pathspec.h b/pathspec.h index 41f6adfbb4..688aedc553 100644 --- a/pathspec.h +++ b/pathspec.h @@ -130,6 +130,14 @@ void parse_pathspec_file(struct pathspec *pathspec, void copy_pathspec(struct pathspec *dst, const struct pathspec *src); void clear_pathspec(struct pathspec *); +/* + * Add a human-readable string to "out" representing the PATHSPEC_* flags set + * in "magic". The result is suitable for error messages, but not for + * parsing as pathspec magic itself (you get 'icase' with quotes, not + * :(icase)). + */ +void pathspec_magic_names(unsigned magic, struct strbuf *out); + static inline int ps_strncmp(const struct pathspec_item *item, const char *s1, const char *s2, size_t n) { |