summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-03-18 17:33:46 -0400
committerEdward Thomson <ethomson@github.com>2016-03-24 15:59:48 -0400
commitba6f86eb2e100ad6f39e70bd52d7144df1b43a1a (patch)
tree1c27cf8a021ac4771be8d8d39d6904a5ebe572d8 /src/path.h
parent82a1aab647c9a587e0b8959719a6ea507a68ea31 (diff)
downloadlibgit2-ba6f86eb2e100ad6f39e70bd52d7144df1b43a1a.tar.gz
Introduce `git_path_common_dirlen`
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/path.h b/src/path.h
index 875c8cb7e..f31cacc70 100644
--- a/src/path.h
+++ b/src/path.h
@@ -203,6 +203,18 @@ extern bool git_path_contains(git_buf *dir, const char *item);
extern bool git_path_contains_dir(git_buf *parent, const char *subdir);
/**
+ * Determine the common directory length between two paths, including
+ * the final path separator. For example, given paths 'a/b/c/1.txt
+ * and 'a/b/c/d/2.txt', the common directory is 'a/b/c/', and this
+ * will return the length of the string 'a/b/c/', which is 6.
+ *
+ * @param one The first path
+ * @param two The second path
+ * @return The length of the common directory
+ */
+extern size_t git_path_common_dirlen(const char *one, const char *two);
+
+/**
* Make the path relative to the given parent path.
*
* @param path The path to make relative