diff options
| author | Russell Belfer <rb@github.com> | 2012-07-31 17:02:54 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-08-22 16:07:19 -0700 |
| commit | ca1b6e54095a7e28d468a832f143025feae6cd4f (patch) | |
| tree | 0ff9b9fbf71cd4f0489985b64f57590687361cd2 /src/path.h | |
| parent | 662880ca60e4d1662bb10648522242ac54797720 (diff) | |
| download | libgit2-ca1b6e54095a7e28d468a832f143025feae6cd4f.tar.gz | |
Add template dir and set gid to repo init
This extends git_repository_init_ext further with support for
initializing the repository from an external template directory
and with support for the "create shared" type flags that make a
set GID repository directory.
This also adds tests for much of the new functionality to the
existing `repo/init.c` test suite.
Also, this adds a bunch of new utility functions including a
very general purpose `git_futils_mkdir` (with the ability to
make paths and to chmod the paths post-creation) and a file
tree copying function `git_futils_cp_r`. Also, this includes
some new path functions that were useful to keep the code
simple.
Diffstat (limited to 'src/path.h')
| -rw-r--r-- | src/path.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h index 14618b2fc..b6292277f 100644 --- a/src/path.h +++ b/src/path.h @@ -58,6 +58,11 @@ extern int git_path_dirname_r(git_buf *buffer, const char *path); extern char *git_path_basename(const char *path); extern int git_path_basename_r(git_buf *buffer, const char *path); +/* Return the offset of the start of the basename. Unlike the other + * basename functions, this returns 0 if the path is empty. + */ +extern size_t git_path_basename_offset(git_buf *buffer); + extern const char *git_path_topdir(const char *path); /** @@ -186,6 +191,15 @@ extern bool git_path_contains_dir(git_buf *parent, const char *subdir); extern bool git_path_contains_file(git_buf *dir, const char *file); /** + * Prepend base to unrooted path or just copy path over. + * + * This will optionally return the index into the path where the "root" + * is, either the end of the base directory prefix or the path root. + */ +extern int git_path_join_unrooted( + git_buf *path_out, const char *path, const char *base, ssize_t *root_at); + +/** * Clean up path, prepending base if it is not already rooted. */ extern int git_path_prettify(git_buf *path_out, const char *path, const char *base); |
