summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8f298f3)
raw | patch | inline | side by side (parent: 8f298f3)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 25 Mar 2008 20:43:38 +0000 (21:43 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 26 Mar 2008 08:40:32 +0000 (09:40 +0100) |
The chosen color is red with bold font, however, maybe all other refs
should be toned down and only the current branch should use bold font.
should be toned down and only the current branch should use bold font.
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index 5524a07ac3ef2d46eb000fba9a8b52cc6161b262..a1a6a803cfda4730320b5cb5cb9320ac031646dd 100644 (file)
--- a/tig.c
+++ b/tig.c
unsigned int ltag:1; /* If so, is the tag local? */
unsigned int remote:1; /* Is it a remote ref? */
unsigned int next:1; /* For ref lists: are there more refs? */
+ unsigned int head:1; /* Is it the current HEAD? */
};
static struct ref **get_refs(char *id);
static char opt_path[SIZEOF_STR] = "";
static char opt_file[SIZEOF_STR] = "";
static char opt_ref[SIZEOF_REF] = "";
+static char opt_head[SIZEOF_REF] = "";
static FILE *opt_pipe = NULL;
static char opt_encoding[20] = "UTF-8";
static bool opt_utf8 = TRUE;
LINE(MAIN_LOCAL_TAG,"", COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD), \
LINE(MAIN_REMOTE, "", COLOR_YELLOW, COLOR_DEFAULT, A_BOLD), \
LINE(MAIN_REF, "", COLOR_CYAN, COLOR_DEFAULT, A_BOLD), \
+LINE(MAIN_HEAD, "", COLOR_RED, COLOR_DEFAULT, A_BOLD), \
LINE(MAIN_REVGRAPH,"", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(TREE_DIR, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
LINE(TREE_FILE, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
@@ -4762,6 +4765,8 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select
do {
if (type == LINE_CURSOR)
;
+ else if (commit->refs[i]->head)
+ wattrset(view->win, get_line_attr(LINE_MAIN_HEAD));
else if (commit->refs[i]->ltag)
wattrset(view->win, get_line_attr(LINE_MAIN_LOCAL_TAG));
else if (commit->refs[i]->tag)
bool ltag = FALSE;
bool remote = FALSE;
bool check_replace = FALSE;
+ bool head = FALSE;
if (!strncmp(name, "refs/tags/", STRING_SIZE("refs/tags/"))) {
if (!strcmp(name + namelen - 3, "^{}")) {
} else if (!strncmp(name, "refs/heads/", STRING_SIZE("refs/heads/"))) {
namelen -= STRING_SIZE("refs/heads/");
name += STRING_SIZE("refs/heads/");
+ head = !strncmp(opt_head, name, namelen);
} else if (!strcmp(name, "HEAD")) {
return OK;
ref->tag = tag;
ref->ltag = ltag;
ref->remote = remote;
+ ref->head = head;
string_copy_rev(ref->id, id);
return OK;
* Default to true for the unknown case. */
opt_is_inside_work_tree = strcmp(name, "false") ? TRUE : FALSE;
- } else {
+ } else if (opt_cdup[0] == ' ') {
string_ncopy(opt_cdup, name, namelen);
+ } else {
+ if (!strncmp(name, "refs/heads/", STRING_SIZE("refs/heads/"))) {
+ namelen -= STRING_SIZE("refs/heads/");
+ name += STRING_SIZE("refs/heads/");
+ string_ncopy(opt_head, name, namelen);
+ }
}
return OK;
}
-/* XXX: The line outputted by "--show-cdup" can be empty so the option
- * must be the last one! */
static int
load_repo_info(void)
{
- return read_properties(popen("git rev-parse --git-dir --is-inside-work-tree --show-cdup 2>/dev/null", "r"),
- "=", read_repo_info);
+ int result;
+ FILE *pipe = popen("git rev-parse --git-dir --is-inside-work-tree "
+ " --show-cdup --symbolic-full-name HEAD 2>/dev/null", "r");
+
+ /* XXX: The line outputted by "--show-cdup" can be empty so
+ * initialize it to something invalid to make it possible to
+ * detect whether it has been set or not. */
+ opt_cdup[0] = ' ';
+
+ result = read_properties(pipe, "=", read_repo_info);
+ if (opt_cdup[0] == ' ')
+ opt_cdup[0] = 0;
+
+ return result;
}
static int
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 86d94c00e52879cd9a1ae0a1bbdd57f03f920e17..b6fe7eb3e0e2460d0a93e5102960658b18b50f9b 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
delimiting long author names and labels for tag and branch references.
*main-date*, *main-author*, *main-commit*, *main-delim*, *main-tag*,
-*main-local-tag*, *main-ref*, *main-remote*, *main-revgraph*
+*main-local-tag*, *main-ref*, *main-remote*, *main-head*, *main-revgraph*
Blame view colors::