Skip to content

Commit

Permalink
prefix_filename: move docstring to header file
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Mar 21, 2017
1 parent a1be47e commit 5980197
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 0 additions & 5 deletions abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ char *absolute_pathdup(const char *path)
return strbuf_detach(&sb, NULL);
}

/*
* Unlike prefix_path, this should be used if the named file does
* not have to interact with index entry; i.e. name of a random file
* on the filesystem.
*/
const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)
{
static struct strbuf path = STRBUF_INIT;
Expand Down
12 changes: 12 additions & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,19 @@ extern const char *setup_git_directory_gently(int *);
extern const char *setup_git_directory(void);
extern char *prefix_path(const char *prefix, int len, const char *path);
extern char *prefix_path_gently(const char *prefix, int len, int *remaining, const char *path);

/*
* Concatenate "prefix" (if len is non-zero) and "path", with no
* connecting characters (so "prefix" should end with a "/").
* Unlike prefix_path, this should be used if the named file does
* not have to interact with index entry; i.e. name of a random file
* on the filesystem.
*
* The return value may point to static storage which will be overwritten by
* further calls.
*/
extern const char *prefix_filename(const char *prefix, int len, const char *path);

extern int check_filename(const char *prefix, const char *name);
extern void verify_filename(const char *prefix,
const char *name,
Expand Down

0 comments on commit 5980197

Please sign in to comment.