summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJameson Miller <jamill@microsoft.com>2014-08-20 10:24:41 -0400
committerJameson Miller <jamill@microsoft.com>2014-09-02 21:07:26 -0400
commitbc737620dd0d331cb80c22d074569fe29b7ab585 (patch)
tree02845048ed92a316433bf6c38d8283408d6b530f /include
parent0ee9f31c3b11116ab5806ab80d03b1d37197d6ce (diff)
downloadlibgit2-jamill/relative_gitlink.tar.gz
Introduce option to use relative paths for repository work directoryjamill/relative_gitlink
Teach git_repository_init_ext to use relative paths for the gitlink to the work directory. This is used when creating a sub repository where the sub repository resides in the parent repository's .git directory.
Diffstat (limited to 'include')
-rw-r--r--include/git2/repository.h3
-rw-r--r--include/git2/submodule.h18
2 files changed, 21 insertions, 0 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h
index 18e515cb0..268782648 100644
--- a/include/git2/repository.h
+++ b/include/git2/repository.h
@@ -196,6 +196,8 @@ GIT_EXTERN(int) git_repository_init(
* looking the "template_path" from the options if set, or the
* `init.templatedir` global config if not, or falling back on
* "/usr/share/git-core/templates" if it exists.
+ * * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is
+ * specified, use relative paths for the gitdir and core.worktree.
*/
typedef enum {
GIT_REPOSITORY_INIT_BARE = (1u << 0),
@@ -204,6 +206,7 @@ typedef enum {
GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
+ GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6),
} git_repository_init_flag_t;
/**
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 864d1c58c..616890df6 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -471,6 +471,24 @@ GIT_EXTERN(git_submodule_recurse_t) git_submodule_set_fetch_recurse_submodules(
GIT_EXTERN(int) git_submodule_init(git_submodule *submodule, int overwrite);
/**
+ * Set up the subrepository for a submodule in preparation for clone.
+ *
+ * This function can be called to init and set up a submodule
+ * repository from a submodule in preparation to clone it from
+ * its remote.
+ *
+ * @param out Output pointer to the created git repository.
+ * @param sm The submodule to create a new subrepository from.
+ * @param use_gitlink Should the workdir contain a gitlink to
+ * the repo in .git/modules vs. repo directly in workdir.
+ * @return 0 on success, <0 on failure.
+ */
+GIT_EXTERN(int) git_submodule_repo_init(
+ git_repository **out,
+ const git_submodule *sm,
+ int use_gitlink);
+
+/**
* Copy submodule remote info into submodule repo.
*
* This copies the information about the submodules URL into the checked out