[gitg] Add HEAD in refs list if head is detached
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg] Add HEAD in refs list if head is detached
- Date: Tue, 16 Dec 2014 07:39:50 +0000 (UTC)
commit 78cf3561d7e28fca63a1a375f0a6c1b9520b2bf5
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Tue Dec 16 08:39:11 2014 +0100
Add HEAD in refs list if head is detached
gitg/history/gitg-history-refs-list.vala | 9 +++++++++
libgitg/gitg-ref.vala | 5 +++++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gitg/history/gitg-history-refs-list.vala b/gitg/history/gitg-history-refs-list.vala
index 382441e..25e2389 100644
--- a/gitg/history/gitg-history-refs-list.vala
+++ b/gitg/history/gitg-history-refs-list.vala
@@ -692,6 +692,15 @@ public class RefsList : Gtk.ListBox
try
{
+ if (d_repository.is_head_detached())
+ {
+ head = add_ref_internal(d_repository.lookup_reference("HEAD"));
+ }
+ }
+ catch {}
+
+ try
+ {
d_repository.references_foreach_name((nm) => {
Gitg.Ref? r;
diff --git a/libgitg/gitg-ref.vala b/libgitg/gitg-ref.vala
index 1cd8ede..c405775 100644
--- a/libgitg/gitg-ref.vala
+++ b/libgitg/gitg-ref.vala
@@ -112,6 +112,11 @@ public class ParsedRefName : Object
d_shortname = name;
d_prefix = null;
+ if (d_name == "HEAD")
+ {
+ rtype = RefType.BRANCH;
+ }
+
for (var i = 0; i < prefixes.length; ++i)
{
if (!d_name.has_prefix(prefixes[i]))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]