prefix_filename: move docstring to header file

This is a public function, so we should make its documentation available near the declaration. While we're at it, we can give a few details about how it works. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 20, 2017 at 21:21 UTC 598019769cbaa38495b0c04297efa13d0f4a572e
2 files changed +12 -5
abspath.c
-5
@@ -246,11 +246,6 @@ char *absolute_pathdup(const char *path)
246 return strbuf_detach(&sb, NULL);
247 }
248
249 -/*
250 - * Unlike prefix_path, this should be used if the named file does
251 - * not have to interact with index entry; i.e. name of a random file
252 - * on the filesystem.
253 - */
249 const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
250 {
251 static struct strbuf path = STRBUF_INIT;
cache.h
+12
@@ -529,7 +529,19 @@ extern const char *setup_git_directory_gently(int *);
529 extern const char *setup_git_directory(void);
530 extern char *prefix_path(const char *prefix, int len, const char *path);
531 extern char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);
532 +
533 +/*
534 + * Concatenate "prefix" (if len is non-zero) and "path", with no
535 + * connecting characters (so "prefix" should end with a "/").
536 + * Unlike prefix_path, this should be used if the named file does
537 + * not have to interact with index entry; i.e. name of a random file
538 + * on the filesystem.
539 + *
540 + * The return value may point to static storage which will be overwritten by
541 + * further calls.
542 + */
543 extern const char *prefix_filename(const char *prefix, int len, const char *path);
544 +
545 extern int check_filename(const char *prefix, const char *name);
546 extern void verify_filename(const char *prefix,
547 const char *name,