summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 745649d)
raw | patch | inline | side by side (parent: 745649d)
author | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 10 Apr 2011 03:18:40 +0000 (23:18 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Sun, 10 Apr 2011 03:18:40 +0000 (23:18 -0400) |
tig.c | patch | blob | history |
index 047b853b67396961cd12361489cb9a911843c140..65973d2bcb4ea659170d73ee25f9782b6082953d 100644 (file)
--- a/tig.c
+++ b/tig.c
return draw_graphic(view, LINE_DEFAULT, &separator, 1, TRUE);
}
+static bool
+draw_refs(struct view *view, struct ref_list *refs)
+{
+ size_t i;
+
+ if (!opt_show_refs || !refs)
+ return FALSE;
+
+ for (i = 0; i < refs->size; i++) {
+ struct ref *ref = refs->refs[i];
+ enum line_type type;
+
+ if (ref->head)
+ type = LINE_MAIN_HEAD;
+ else if (ref->ltag)
+ type = LINE_MAIN_LOCAL_TAG;
+ else if (ref->tag)
+ type = LINE_MAIN_TAG;
+ else if (ref->tracked)
+ type = LINE_MAIN_TRACKED;
+ else if (ref->remote)
+ type = LINE_MAIN_REMOTE;
+ else
+ type = LINE_MAIN_REF;
+
+ if (draw_text(view, type, "[") ||
+ draw_text(view, type, ref->name) ||
+ draw_text(view, type, "]"))
+ return TRUE;
+
+ if (draw_text(view, LINE_DEFAULT, " "))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static bool
draw_view_line(struct view *view, unsigned int lineno)
{
if (opt_rev_graph && draw_graph(view, &commit->graph))
return TRUE;
- if (opt_show_refs && commit->refs) {
- size_t i;
-
- for (i = 0; i < commit->refs->size; i++) {
- struct ref *ref = commit->refs->refs[i];
- enum line_type type;
-
- if (ref->head)
- type = LINE_MAIN_HEAD;
- else if (ref->ltag)
- type = LINE_MAIN_LOCAL_TAG;
- else if (ref->tag)
- type = LINE_MAIN_TAG;
- else if (ref->tracked)
- type = LINE_MAIN_TRACKED;
- else if (ref->remote)
- type = LINE_MAIN_REMOTE;
- else
- type = LINE_MAIN_REF;
-
- if (draw_text(view, type, "[") ||
- draw_text(view, type, ref->name) ||
- draw_text(view, type, "]"))
- return TRUE;
-
- if (draw_text(view, LINE_DEFAULT, " "))
- return TRUE;
- }
- }
+ if (draw_refs(view, commit->refs))
+ return TRUE;
draw_text(view, LINE_DEFAULT, commit->title);
return TRUE;