diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-27 10:59:26 -0700 |
commit | a026bde1ac84f90f0b82faa18890b2023c5198d5 (patch) | |
tree | 8e976b861d4b23904c09bb1fbdd8004f37cb6e6f /cache.h | |
parent | 09fb53568e3e00e30891b118045aa07ede524103 (diff) | |
parent | 3b754eedd58636926d07b14a34799a3aa7b8ebc2 (diff) | |
download | git-a026bde1ac84f90f0b82faa18890b2023c5198d5.tar.gz |
Merge branch 'jk/prefix-filename'
Code clean-up with minor bugfixes.
* jk/prefix-filename:
bundle: use prefix_filename with bundle path
prefix_filename: simplify windows #ifdef
prefix_filename: return newly allocated string
prefix_filename: drop length parameter
prefix_filename: move docstring to header file
hash-object: fix buffer reuse with --path in a subdirectory
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -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); -extern const char *prefix_filename(const char *prefix, int len, 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 is always a newly allocated string (even if the + * prefix was empty). + */ +extern char *prefix_filename(const char *prefix, const char *path); + extern int check_filename(const char *prefix, const char *name); extern void verify_filename(const char *prefix, const char *name, |