vendor/libgit2/src/path.h in rugged-0.17.0.b6 vs vendor/libgit2/src/path.h in rugged-0.17.0.b7
- old
+ new
@@ -56,10 +56,15 @@
* the length of the basename (which will be >= 0).
*/
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);
/**
* Find offset to root of path if path has one.
*
@@ -182,9 +187,18 @@
* @param file File name to look for in parent
* @param append_if_exists If true, then file will be appended to the path if it does exist
* @return true if file exists, false otherwise.
*/
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);