summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-06-17 18:13:14 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-06-26 18:18:10 +0200
commit9c82357be74bc5404038ec3c16706b1805843556 (patch)
tree6ac361b40e1629136527c4da0427bc1cf213d00d /include/git2
parent0b10c9ea6ef5d85d862edd044d96561c4fd16e9b (diff)
downloadlibgit2-9c82357be74bc5404038ec3c16706b1805843556.tar.gz
Add a remotes API
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/branch.h9
-rw-r--r--include/git2/refspec.h22
-rw-r--r--include/git2/remote.h58
-rw-r--r--include/git2/types.h3
4 files changed, 92 insertions, 0 deletions
diff --git a/include/git2/branch.h b/include/git2/branch.h
new file mode 100644
index 000000000..456b7d1ac
--- /dev/null
+++ b/include/git2/branch.h
@@ -0,0 +1,9 @@
+#ifndef INCLUDE_branch_h__
+#define INCLUDE_branch_h__
+
+struct git_branch {
+ char *remote; /* TODO: Make this a git_remote */
+ char *merge;
+};
+
+#endif
diff --git a/include/git2/refspec.h b/include/git2/refspec.h
new file mode 100644
index 000000000..d45364f71
--- /dev/null
+++ b/include/git2/refspec.h
@@ -0,0 +1,22 @@
+#ifndef INCLUDE_git_refspec_h__
+#define INCLUDE_git_refspec_h__
+
+#include "git2/types.h"
+
+/**
+ * Get the source specifier
+ *
+ * @param refspec the refspec
+ * @return the refspec's source specifier
+ */
+const char *git_refspec_src(const git_refspec *refspec);
+
+/**
+ * Get the destination specifier
+ *
+ * @param refspec the refspec
+ * @return the refspec's destination specifier
+ */
+const char *git_refspec_dst(const git_refspec *refspec);
+
+#endif
diff --git a/include/git2/remote.h b/include/git2/remote.h
new file mode 100644
index 000000000..8edb743d8
--- /dev/null
+++ b/include/git2/remote.h
@@ -0,0 +1,58 @@
+#ifndef INCLUDE_git_remote_h__
+#define INCLUDE_git_remote_h__
+
+#include "git2/common.h"
+#include "git2/repository.h"
+#include "git2/refspec.h"
+
+/**
+ * Get the information for a particular remote
+ *
+ * @param out pointer to the new remote object
+ * @param cfg the repository's configuration
+ * @param name the remote's name
+ * @return 0 on success; error value otherwise
+ */
+GIT_EXTERN(int) git_remote_get(struct git_remote **out, struct git_config *cfg, const char *name);
+
+/**
+ * Get the remote's name
+ *
+ * @param remote the remote
+ * @return a pointer to the name
+ */
+GIT_EXTERN(const char *) git_remote_name(struct git_remote *remote);
+
+/**
+ * Get the remote's url
+ *
+ * @param remote the remote
+ * @return a pointer to the url
+ */
+GIT_EXTERN(const char *) git_remote_url(struct git_remote *remote);
+
+/**
+ * Get the fetch refspec
+ *
+ * @param remote the remote
+ * @return a pointer to the fetch refspec or NULL if it doesn't exist
+ */
+GIT_EXTERN(const git_refspec *) git_remote_fetchspec(struct git_remote *remote);
+
+/**
+ * Get the push refspec
+ *
+ * @param remote the remote
+ * @return a pointer to the push refspec or NULL if it doesn't exist
+ */
+
+GIT_EXTERN(const git_refspec *) git_remote_fetchspec(struct git_remote *remote);
+
+/**
+ * Free the memory associated with a remote
+ *
+ * @param remote the remote to free
+ */
+GIT_EXTERN(void) git_remote_free(struct git_remote *remote);
+
+#endif
diff --git a/include/git2/types.h b/include/git2/types.h
index 499ba98ad..963156f85 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -167,6 +167,9 @@ typedef enum {
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
} git_rtype;
+typedef struct git_refspec git_refspec;
+typedef struct git_remote git_remote;
+
/** @} */
GIT_END_DECL