summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 823057f)
raw | patch | inline | side by side (parent: 823057f)
author | Dominik Vogt <dvogt@ffm.tc.iot.dtag.de> | |
Wed, 19 Mar 2008 22:08:40 +0000 (23:08 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 20 Mar 2008 17:59:54 +0000 (18:59 +0100) |
Added a new colour main-local-tag.
Signed-off-by: Dominik Vogt <dvogt@ffm.tc.iot.dtag.de>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Dominik Vogt <dvogt@ffm.tc.iot.dtag.de>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index 6cfe40e36b334ef6fdcddf3e76e48243da13c4d7..025a6f8547c163ccbec81c2764e149410cc1b52b 100644 (file)
--- a/tig.c
+++ b/tig.c
char *name; /* Ref name; tag or head names are shortened. */
char id[SIZEOF_REV]; /* Commit SHA1 ID */
unsigned int tag:1; /* Is it a tag? */
+ 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? */
};
LINE(MAIN_COMMIT, "", COLOR_DEFAULT, COLOR_DEFAULT, 0), \
LINE(MAIN_DELIM, "", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(MAIN_TAG, "", COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD), \
+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_REVGRAPH,"", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
@@ -4260,6 +4262,8 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select
do {
if (type == LINE_CURSOR)
;
+ else if (commit->refs[i]->ltag)
+ wattrset(view->win, get_line_attr(LINE_MAIN_LOCAL_TAG));
else if (commit->refs[i]->tag)
wattrset(view->win, get_line_attr(LINE_MAIN_TAG));
else if (commit->refs[i]->remote)
{
struct ref *ref;
bool tag = FALSE;
+ bool ltag = FALSE;
bool remote = FALSE;
+ bool check_replace = FALSE;
if (!strncmp(name, "refs/tags/", STRING_SIZE("refs/tags/"))) {
- /* Commits referenced by tags has "^{}" appended. */
- if (name[namelen - 1] != '}')
- return OK;
-
- while (namelen > 0 && name[namelen] != '^')
- namelen--;
+ if (!strcmp(name + namelen - 3, "^{}")) {
+ namelen -= 3;
+ name[namelen] = 0;
+ if (refs_size > 0 && refs[refs_size - 1].ltag == TRUE)
+ check_replace = TRUE;
+ } else {
+ ltag = TRUE;
+ }
tag = TRUE;
namelen -= STRING_SIZE("refs/tags/");
return OK;
}
+ if (check_replace && !strcmp(name, refs[refs_size - 1].name)) {
+ /* it's an annotated tag, replace the previous sha1 with the
+ * resolved commit id; relies on the fact git-ls-remote lists
+ * the commit id of an annotated tag right beofre the commit id
+ * it points to. */
+ refs[refs_size - 1].ltag = ltag;
+ string_copy_rev(refs[refs_size - 1].id, id);
+
+ return OK;
+ }
refs = realloc(refs, sizeof(*refs) * (refs_size + 1));
if (!refs)
return ERR;
strncpy(ref->name, name, namelen);
ref->name[namelen] = 0;
ref->tag = tag;
+ ref->ltag = ltag;
ref->remote = remote;
string_copy_rev(ref->id, id);
diff --git a/tigrc.5.txt b/tigrc.5.txt
index c974efcdd6c2d12c7c60a230dfd648793ff777f0..e73d7002ad9b454fa0884f4b33b771d41018e147 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-ref*, *main-remote*, *main-revgraph*
+*main-local-tag*, *main-ref*, *main-remote*, *main-revgraph*
--