summaryrefslogtreecommitdiff
path: root/src/path.h
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-08-23 14:10:47 -0700
committerVicent Martí <vicent@github.com>2012-08-23 14:10:47 -0700
commitc920e162325d0f9acba46a19c4619e6bfa17707e (patch)
treebb1d939d73ce2c2bd9d3001c643bcf28602a8271 /src/path.h
parent5fdc41e76591aebdbae3b49440bc2c8b2430718c (diff)
parente9ca852e4d77e1b1723a2dceddfa2037677e2fb4 (diff)
downloadlibgit2-c920e162325d0f9acba46a19c4619e6bfa17707e.tar.gz
Merge pull request #844 from arrbee/init-extended
Add git_repository_init_ext for power initters
Diffstat (limited to 'src/path.h')
-rw-r--r--src/path.h14
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);