diff options
author | Ben Straub <bstraub@github.com> | 2012-07-17 19:08:34 +0400 |
---|---|---|
committer | Ben Straub <bstraub@github.com> | 2012-07-17 19:08:34 +0400 |
commit | bfc65634050dc52e3ed6b4497ebbb511e39d6e1e (patch) | |
tree | 32b03847b8a152b69bc3b48b6bb32e7b8621f45e /src/path.h | |
parent | 1d68fcd04b21a2c5665d0ca6a5543e7166c73457 (diff) | |
parent | ea5d2ce4cfa6cec89e2d844a70d1eb24bb401c7d (diff) |
Merge branch 'development' into clone
Diffstat (limited to 'src/path.h')
-rw-r--r-- | src/path.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h index a845b3a14..5eecb7261 100644 --- a/src/path.h +++ b/src/path.h @@ -208,6 +208,29 @@ extern int git_path_prettify_dir(git_buf *path_out, const char *path, const char extern int git_path_find_dir(git_buf *dir, const char *path, const char *base); /** + * Resolve relative references within a path. + * + * This eliminates "./" and "../" relative references inside a path, + * as well as condensing multiple slashes into single ones. It will + * not touch the path before the "ceiling" length. + * + * Additionally, this will recognize an "c:/" drive prefix or a "xyz://" URL + * prefix and not touch that part of the path. + */ +extern int git_path_resolve_relative(git_buf *path, size_t ceiling); + +/** + * Apply a relative path to base path. + * + * Note that the base path could be a filename or a URL and this + * should still work. The relative path is walked segment by segment + * with three rules: series of slashes will be condensed to a single + * slash, "." will be eaten with no change, and ".." will remove a + * segment from the base path. + */ +extern int git_path_apply_relative(git_buf *target, const char *relpath); + +/** * Walk each directory entry, except '.' and '..', calling fn(state). * * @param pathbuf buffer the function reads the initial directory |