summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-08-20 10:23:39 -0400
committerJameson Miller <jamill@microsoft.com>2014-09-02 21:07:23 -0400
commit0ee9f31c3b11116ab5806ab80d03b1d37197d6ce (patch)
tree9929bc43c57d5e3c7bd622fdd0826e96edee15cc /src/path.h
parent6f3082d90fa70144ed4f5ae75c75366fce0a4f5e (diff)
downloadlibgit2-0ee9f31c3b11116ab5806ab80d03b1d37197d6ce.tar.gz
Introduce git_path_make_relative
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h
index 46d6efe93..d0a9de707 100644
--- a/src/path.h
+++ b/src/path.h
@@ -197,6 +197,17 @@ extern bool git_path_contains(git_buf *dir, const char *item);
extern bool git_path_contains_dir(git_buf *parent, const char *subdir);
/**
+ * Make the path relative to the given parent path.
+ *
+ * @param path The path to make relative
+ * @param parent The parent path to make path relative to
+ * @return 0 if path was made relative, GIT_ENOTFOUND
+ * if there was not common root between the paths,
+ * or <0.
+ */
+extern int git_path_make_relative(git_buf *path, const char *parent);
+
+/**
* Check if the given path contains the given file.
*
* @param dir Directory path that might contain file