[gitg] Use Ggit.Commit.amend to amend
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Use Ggit.Commit.amend to amend
- Date: Tue, 24 Jun 2014 15:30:28 +0000 (UTC)
commit 682b31a6099ebaed077e8880acd4af61161a3ea9
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Tue Jun 24 17:30:08 2014 +0200
Use Ggit.Commit.amend to amend
libgitg/gitg-stage.vala | 50 +++++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/libgitg/gitg-stage.vala b/libgitg/gitg-stage.vala
index f61d767..1715b7c 100644
--- a/libgitg/gitg-stage.vala
+++ b/libgitg/gitg-stage.vala
@@ -414,39 +414,39 @@ public class Stage : Object
headoid = head.resolve().get_target();
} catch {}
- Ggit.OId[] parents;
-
- if (headoid == null)
- {
- parents = new Ggit.OId[] {};
- }
- else
+ if (!amend)
{
- if (amend)
- {
- var commit = d_repository.lookup<Ggit.Commit>(headoid);
- var p = commit.get_parents();
-
- parents = new Ggit.OId[p.size()];
+ Ggit.OId[] parents;
- for (int i = 0; i < p.size(); ++i)
- {
- parents[i] = p.get_id(i);
- }
+ if (headoid == null)
+ {
+ parents = new Ggit.OId[] {};
}
else
{
parents = new Ggit.OId[] { headoid };
}
- }
- ret = d_repository.create_commit_from_ids("HEAD",
- author,
- committer,
- encoding,
- emsg,
- treeoid,
- parents);
+ ret = d_repository.create_commit_from_ids("HEAD",
+ author,
+ committer,
+ encoding,
+ emsg,
+ treeoid,
+ parents);
+ }
+ else
+ {
+ var headcommit = d_repository.lookup<Ggit.Commit>(headoid);
+ var tree = d_repository.lookup<Ggit.Tree>(treeoid);
+
+ ret = headcommit.amend("HEAD",
+ author,
+ committer,
+ encoding,
+ emsg,
+ tree);
+ }
bool always_update = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]