[gitg/wip/submodules] Added Stage.stage_commit
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/submodules] Added Stage.stage_commit
- Date: Sun, 14 Dec 2014 11:08:54 +0000 (UTC)
commit 5f207a31277d53810305def7fe9b29f54425cc35
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sun Dec 14 12:05:54 2014 +0100
Added Stage.stage_commit
libgitg/gitg-stage.vala | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index 687d879..a0af236 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -701,6 +701,26 @@ public class Stage : Object
yield stage(d_repository.get_workdir().resolve_relative_path(path));
}
+ /**
+ * Stage a commit to the index.
+ *
+ * @param path path relative to the working directory.
+ * @param id the id of the commit object to stage at the given path.
+ *
+ * Stage a commit to the index with a relative path. This will record the
+ * given commit id for file pointed to at path in the index.
+ */
+ public async void stage_commit(string path, Ggit.Commit commit) throws Error
+ {
+ yield thread_index((index) => {
+ var entry = d_repository.create_index_entry_for_path(path, commit.get_id());
+ entry.set_commit(commit);
+
+ index.add(entry);
+ index.write();
+ });
+ }
+
private void copy_stream(OutputStream dest, InputStream src, ref size_t pos, size_t index, size_t
length) throws Error
{
if (length == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]