summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorEric Myhre <hash@exultant.us>2016-07-08 01:37:22 -0500
committerPatrick Steinhardt <ps@pks.im>2017-05-05 10:41:45 +0200
commit4bc16c376bde9dca63393e57d0f583cb239a29a2 (patch)
treee5e897a26b13b5ac75365cfee666477b70db883c /include/git2
parent8897f8fe687f11d327be30873480c5d02a6a00a6 (diff)
downloadlibgit2-4bc16c376bde9dca63393e57d0f583cb239a29a2.tar.gz
remote: add function to create detached remotes
Right now it is only possible to create remotes from a repository. While this is probably the most common use-case, there are commands which make sense even without a repository, e.g. the equivalence of `git ls-remote`. Add a new function `git_remote_create_detached`, which simply accepts a URL.
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/remote.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index e9e4e5b65..b1e04d557 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -76,6 +76,24 @@ GIT_EXTERN(int) git_remote_create_anonymous(
const char *url);
/**
+ * Create a remote without a connected local repo
+ *
+ * Create a remote with the given url in-memory. You can use this when
+ * you have a URL instead of a remote's name.
+ *
+ * Contrasted with git_remote_create_anonymous, a detached remote
+ * will not consider any repo configuration values (such as insteadof url
+ * substitutions).
+ *
+ * @param out pointer to the new remote objects
+ * @param url the remote repository's URL
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_remote_create_detached(
+ git_remote **out,
+ const char *url);
+
+/**
* Get the information for a particular remote
*
* The name will be checked for validity.