From ed86301f68fcbb17c5d1c7a3258e4705b3b1da9c Mon Sep 17 00:00:00 2001 From: Atharva Raykar Date: Tue, 10 Aug 2021 17:16:36 +0530 Subject: dir: libify and export helper functions from clone.c These functions can be useful to other parts of Git. Let's move them to dir.c, while renaming them to be make their functionality more explicit. Signed-off-by: Atharva Raykar Mentored-by: Christian Couder Mentored-by: Shourya Shukla Signed-off-by: Junio C Hamano --- dir.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dir.h') diff --git a/dir.h b/dir.h index b3e1a54a97..63ff04f5ac 100644 --- a/dir.h +++ b/dir.h @@ -453,6 +453,17 @@ static inline int is_dot_or_dotdot(const char *name) int is_empty_dir(const char *dir); +/* + * Retrieve the "humanish" basename of the given Git URL. + * + * For example: + * /path/to/repo.git => "repo" + * host.xz:foo/.git => "foo" + * http://example.com/user/bar.baz => "bar.baz" + */ +char *git_url_basename(const char *repo, int is_bundle, int is_bare); +void strip_dir_trailing_slashes(char *dir); + void setup_standard_excludes(struct dir_struct *dir); char *get_sparse_checkout_filename(void); -- cgit v1.2.3