[gitg] Do not rely on last commit for parents
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Do not rely on last commit for parents
- Date: Thu, 13 Aug 2015 22:58:30 +0000 (UTC)
commit f058e4516fdf1f4280b7996d3666d992c78ea36e
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Thu Aug 13 20:04:02 2015 +0200
Do not rely on last commit for parents
tests/support/repository.vala | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
---
diff --git a/tests/support/repository.vala b/tests/support/repository.vala
index 6f6ca25..a7368aa 100644
--- a/tests/support/repository.vala
+++ b/tests/support/repository.vala
@@ -22,7 +22,6 @@ using Gitg.Test.Assert;
class Gitg.Test.Repository : Gitg.Test.Test
{
protected Gitg.Repository? d_repository;
- private Ggit.Commit? d_last_commit;
struct File
{
@@ -181,13 +180,22 @@ class Gitg.Test.Repository : Gitg.Test.Test
Ggit.OId commitoid;
+ Ggit.Ref? head = null;
+ Ggit.Commit? parent = null;
+
+ try
+ {
+ head = d_repository.get_head();
+ parent = head.lookup() as Ggit.Commit;
+ } catch {}
+
try
{
Ggit.Commit[] parents;
- if (d_last_commit != null)
+ if (parent != null)
{
- parents = new Ggit.Commit[] {d_last_commit};
+ parents = new Ggit.Commit[] { parent };
}
else
{
@@ -207,15 +215,6 @@ class Gitg.Test.Repository : Gitg.Test.Test
assert_no_error(e);
return;
}
-
- try
- {
- d_last_commit = d_repository.lookup<Ggit.Commit>(commitoid);
- }
- catch (GLib.Error e)
- {
- assert_no_error(e);
- }
}
protected void workdir_remove(string? filename, ...)
@@ -329,8 +328,6 @@ class Gitg.Test.Repository : Gitg.Test.Test
{
string wd;
- d_last_commit = null;
-
try
{
wd = GLib.DirUtils.make_tmp("gitg-test-XXXXXX");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]