Skip to content

Commit 5980197

Browse files
peffgitster
authored andcommitted
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>
1 parent a1be47e commit 5980197

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

abspath.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,6 @@ char *absolute_pathdup(const char *path)
246246
return strbuf_detach(&sb, NULL);
247247
}
248248

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-
*/
254249
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
255250
{
256251
static struct strbuf path = STRBUF_INIT;

cache.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,19 @@ extern const char *setup_git_directory_gently(int *);
529529
extern const char *setup_git_directory(void);
530530
extern char *prefix_path(const char *prefix, int len, const char *path);
531531
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+
*/
532543
extern const char *prefix_filename(const char *prefix, int len, const char *path);
544+
533545
extern int check_filename(const char *prefix, const char *name);
534546
extern void verify_filename(const char *prefix,
535547
const char *name,

0 commit comments

Comments
 (0)