From ce17feb1b3ecfb0344af9b9111a4b4d313d51d7a Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sun, 25 Aug 2019 23:33:39 +0000 Subject: path: add a function to check for path suffix We have a function to strip the path suffix from a commit, but we don't have one to check for a path suffix. For a plain filename, we can use basename, but that requires an allocation, since POSIX allows it to modify its argument. Refactor strip_path_suffix into a helper function and a new function, ends_with_path_components, to meet this need. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- path.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'path.h') diff --git a/path.h b/path.h index 2ba6ca58c8..14d6dcad16 100644 --- a/path.h +++ b/path.h @@ -193,4 +193,7 @@ const char *git_path_merge_head(struct repository *r); const char *git_path_fetch_head(struct repository *r); const char *git_path_shallow(struct repository *r); + +int ends_with_path_components(const char *path, const char *components); + #endif /* PATH_H */ -- cgit v1.2.3