summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/git2.h1
-rw-r--r--include/git2/errors.h1
-rw-r--r--include/git2/object.h8
-rw-r--r--include/git2/push.h80
-rw-r--r--include/git2/remote.h15
-rw-r--r--include/git2/types.h1
6 files changed, 106 insertions, 0 deletions
diff --git a/include/git2.h b/include/git2.h
index d55543986..95475c591 100644
--- a/include/git2.h
+++ b/include/git2.h
@@ -39,6 +39,7 @@
#include "git2/remote.h"
#include "git2/clone.h"
#include "git2/checkout.h"
+#include "git2/push.h"
#include "git2/attr.h"
#include "git2/ignore.h"
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 38b7fe0ae..b4463f722 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -28,6 +28,7 @@ enum {
GIT_EUSER = -7,
GIT_EBAREREPO = -8,
GIT_EORPHANEDHEAD = -9,
+ GIT_ENONFASTFORWARD = -10,
GIT_PASSTHROUGH = -30,
GIT_ITEROVER = -31,
diff --git a/include/git2/object.h b/include/git2/object.h
index fd6ae95c1..44bfc5e29 100644
--- a/include/git2/object.h
+++ b/include/git2/object.h
@@ -95,6 +95,14 @@ GIT_EXTERN(const git_oid *) git_object_id(const git_object *obj);
GIT_EXTERN(git_otype) git_object_type(const git_object *obj);
/**
+ * Get the object type of an object id
+ *
+ * @param obj the repository object
+ * @return the object's type
+ */
+GIT_EXTERN(int) git_object_oid2type(git_otype *type, git_repository *repo, const git_oid *oid);
+
+/**
* Get the repository that owns this object
*
* Freeing or calling `git_repository_close` on the
diff --git a/include/git2/push.h b/include/git2/push.h
new file mode 100644
index 000000000..900a1833e
--- /dev/null
+++ b/include/git2/push.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2009-2012 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+#ifndef INCLUDE_git_push_h__
+#define INCLUDE_git_push_h__
+
+#include "common.h"
+
+/**
+ * @file git2/push.h
+ * @brief Git push management functions
+ * @defgroup git_push push management functions
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/**
+ * Create a new push object
+ *
+ * @param out New push object
+ * @param remote Remote instance
+ *
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_push_new(git_push **out, git_remote *remote);
+
+/**
+ * Add a refspec to be pushed
+ *
+ * @param push The push object
+ * @param refspec Refspec string
+ *
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec);
+
+/**
+ * Actually push all given refspecs
+ *
+ * @param push The push object
+ *
+ * @return 0 or an error code
+ */
+GIT_EXTERN(int) git_push_finish(git_push *push);
+
+/**
+ * Check if remote side successfully unpacked
+ *
+ * @param push The push object
+ *
+ * @return true if equal, false otherwise
+ */
+GIT_EXTERN(int) git_push_unpack_ok(git_push *push);
+
+/**
+ * Call callback `cb' on each status
+ *
+ * @param push The push object
+ * @param cb The callback to call on each object
+ *
+ * @return 0 on success, GIT_EUSER on non-zero callback, or error code
+ */
+GIT_EXTERN(int) git_push_status_foreach(git_push *push,
+ int (*cb)(const char *ref, const char *msg, void *data),
+ void *data);
+
+/**
+ * Free the given push object
+ *
+ * @param push The push object
+ */
+GIT_EXTERN(void) git_push_free(git_push *push);
+
+/** @} */
+GIT_END_DECL
+#endif
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 6471acc6a..3ecdbc4d6 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -189,6 +189,12 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headlist_cb list_cb, void
GIT_EXTERN(int) git_remote_download(git_remote *remote, git_off_t *bytes, git_indexer_stats *stats);
/**
+ *
+ *
+ */
+GIT_EXTERN(int) git_remote_push(git_remote *remote);
+
+/**
* Check whether the remote is connected
*
* Check whether the remote's underlying transport is connected to the
@@ -291,6 +297,14 @@ typedef enum git_remote_completion_type {
} git_remote_completion_type;
/**
+ * Auth data for HTTP authentication.
+ */
+typedef struct http_auth_data {
+ char *username;
+ char *password;
+} http_auth_data;
+
+/**
* The callback settings structure
*
* Set the calbacks to be called by the remote.
@@ -299,6 +313,7 @@ struct git_remote_callbacks {
void (*progress)(const char *str, int len, void *data);
int (*completion)(git_remote_completion_type type, void *data);
int (*update_tips)(const char *refname, const git_oid *a, const git_oid *b, void *data);
+ int (*http_auth)(http_auth_data *auth_data, void *data);
void *data;
};
diff --git a/include/git2/types.h b/include/git2/types.h
index 01ddbf3d6..7f92506d3 100644
--- a/include/git2/types.h
+++ b/include/git2/types.h
@@ -191,6 +191,7 @@ typedef enum {
typedef struct git_refspec git_refspec;
typedef struct git_remote git_remote;
+typedef struct git_push git_push;
typedef struct git_remote_head git_remote_head;
typedef struct git_remote_callbacks git_remote_callbacks;