summaryrefslogtreecommitdiff
path: root/src/repository.c
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 /src/repository.c
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 'src/repository.c')
-rw-r--r--src/repository.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/repository.c b/src/repository.c
index f032c899d..2bab52919 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -1728,6 +1728,28 @@ cleanup:
return error;
}
+int git_repository__set_orig_head(git_repository *repo, const git_oid *orig_head)
+{
+ git_filebuf file = GIT_FILEBUF_INIT;
+ git_buf file_path = GIT_BUF_INIT;
+ char orig_head_str[GIT_OID_HEXSZ];
+ int error = 0;
+
+ git_oid_fmt(orig_head_str, orig_head);
+
+ if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_ORIG_HEAD_FILE)) == 0 &&
+ (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_MERGE_FILE_MODE)) == 0 &&
+ (error = git_filebuf_printf(&file, "%.*s\n", GIT_OID_HEXSZ, orig_head_str)) == 0)
+ error = git_filebuf_commit(&file);
+
+ if (error < 0)
+ git_filebuf_cleanup(&file);
+
+ git_buf_free(&file_path);
+
+ return error;
+}
+
int git_repository_message(git_buf *out, git_repository *repo)
{
git_buf path = GIT_BUF_INIT;