summaryrefslogtreecommitdiff
path: root/include/git2/rebase.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2014-07-14 14:35:01 -0400
committerEdward Thomson <ethomson@microsoft.com>2014-10-26 22:59:08 -0400
commit867a36f3a67d0d1905572b84a3e44093fcac643b (patch)
treed56a5153b3d7aabad6706963a26492bfe2a814db /include/git2/rebase.h
parent9e44289c8dfece4171c7f272389b14d040c72228 (diff)
downloadlibgit2-867a36f3a67d0d1905572b84a3e44093fcac643b.tar.gz
Introduce git_rebase to set up a rebase session
Introduce `git_rebase` to set up a rebase session that can then be continued. Immediately, only merge-type rebase is supported.
Diffstat (limited to 'include/git2/rebase.h')
-rw-r--r--include/git2/rebase.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/git2/rebase.h b/include/git2/rebase.h
new file mode 100644
index 000000000..6eb279412
--- /dev/null
+++ b/include/git2/rebase.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * 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_rebase_h__
+#define INCLUDE_git_rebase_h__
+
+#include "common.h"
+#include "types.h"
+#include "oid.h"
+
+/**
+ * @file git2/rebase.h
+ * @brief Git rebase routines
+ * @defgroup git_rebase Git merge routines
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+typedef struct {
+ unsigned int version;
+
+ /**
+ * Provide a quiet rebase experience; unused by libgit2 but provided for
+ * interoperability with other clients.
+ */
+ int quiet;
+} git_rebase_options;
+
+#define GIT_REBASE_OPTIONS_VERSION 1
+#define GIT_REBASE_OPTIONS_INIT {GIT_REBASE_OPTIONS_VERSION}
+
+/**
+ * Initializes a `git_rebase_options` with default values. Equivalent to
+ * creating an instance with GIT_REBASE_OPTIONS_INIT.
+ *
+ * @param opts the `git_rebase_options` instance to initialize.
+ * @param version the version of the struct; you should pass
+ * `GIT_REBASE_OPTIONS_VERSION` here.
+ * @return Zero on success; -1 on failure.
+ */
+GIT_EXTERN(int) git_rebase_init_options(
+ git_rebase_options *opts,
+ unsigned int version);
+
+/**
+ * Sets up a rebase operation to rebase the changes in ours relative to
+ * upstream onto another branch.
+ *
+ * @param repo The repository to perform the rebase
+ * @param branch The terminal commit to rebase
+ * @param upstream The commit to begin rebasing from, or NULL to rebase all
+ * reachable commits
+ * @param onto The branch to rebase onto, or NULL to rebase onto the given
+ * upstream
+ * @param signature The signature of the rebaser
+ * @param opts Options to specify how rebase is performed
+ * @return Zero on success; -1 on failure.
+ */
+GIT_EXTERN(int) git_rebase(
+ git_repository *repo,
+ const git_merge_head *branch,
+ const git_merge_head *upstream,
+ const git_merge_head *onto,
+ const git_signature *signature,
+ const git_rebase_options *opts);
+
+/** @} */
+GIT_END_DECL
+#endif