[gitg/wip/submodules] Handle displaying of untracked submodules
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/submodules] Handle displaying of untracked submodules
- Date: Sun, 14 Dec 2014 11:09:04 +0000 (UTC)
commit 349083602c07bf9f75db410523e1bfafc096ad55
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Sun Dec 14 12:07:29 2014 +0100
Handle displaying of untracked submodules
gitg/commit/gitg-commit.vala | 43 +++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 13 deletions(-)
---
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 5886794..f612e6d 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -371,20 +371,25 @@ namespace GitgCommit
var commit_tree = commit.get_tree();
var head = d_current_submodule.get_head_id();
- Ggit.Commit head_commit;
+ Ggit.Tree? head_tree = null;
- try
- {
- head_commit = repo.lookup<Gitg.Commit>(head);
- }
- catch (Error e)
+ if (head != null)
{
- // TODO: show error to user
- stderr.printf("Failed to get head commit: %s\n", e.message);
- return;
- }
+ Ggit.Commit head_commit;
+
+ try
+ {
+ head_commit = repo.lookup<Gitg.Commit>(head);
+ }
+ catch (Error e)
+ {
+ // TODO: show error to user
+ stderr.printf("Failed to get head commit: %s\n", e.message);
+ return;
+ }
- var head_tree = head_commit.get_tree();
+ head_tree = head_commit.get_tree();
+ }
Ggit.Diff diff;
@@ -443,12 +448,24 @@ namespace GitgCommit
if (type == IndexType.STAGED)
{
model.set_include(new Ggit.OId[] { submodule.get_index_id() });
- model.set_exclude(new Ggit.OId[] { submodule.get_head_id() });
+
+ var head_id = submodule.get_head_id();
+
+ if (head_id != null)
+ {
+ model.set_exclude(new Ggit.OId[] { head_id });
+ }
}
else
{
+ var index_id = submodule.get_index_id();
+
model.set_include(new Ggit.OId[] { submodule.get_workdir_id() });
- model.set_exclude(new Ggit.OId[] { submodule.get_index_id() });
+
+ if (index_id != null)
+ {
+ model.set_exclude(new Ggit.OId[] { index_id });
+ }
}
d_submodule_history_select_first = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]