index dd9437f5f39f29d3da373c80e9df443571d68adc..b0032ea67a9fd869b658fa3e984c38007a6250d6 100644 (file)
--- a/tig.c
+++ b/tig.c
unsigned char bytes;
size_t i;
- while (is_initial_sep(*author))
+ while (author < end && is_initial_sep(*author))
author++;
bytes = utf8_char_length(author, end);
- if (bytes < sizeof(initials) - 1 - pos) {
- while (bytes--) {
- initials[pos++] = *author++;
- }
+ if (bytes >= sizeof(initials) - 1 - pos)
+ break;
+ while (bytes--) {
+ initials[pos++] = *author++;
}
- for (i = pos; author < end && !is_initial_sep(*author); author++) {
- if (i < sizeof(initials) - 1)
- initials[i++] = *author;
+ i = pos;
+ while (author < end && !is_initial_sep(*author)) {
+ bytes = utf8_char_length(author, end);
+ if (bytes >= sizeof(initials) - 1 - i) {
+ while (author < end && !is_initial_sep(*author))
+ author++;
+ break;
+ }
+ while (bytes--) {
+ initials[i++] = *author++;
+ }
}
initials[i++] = 0;
bool trim = author_trim(cols);
bool abbreviate = author == AUTHOR_ABBREVIATED || !trim;
- if (!author)
+ if (author == AUTHOR_NO)
return "";
if (abbreviate && text)
return get_author_initials(text);
bool trim = author_trim(opt_author_cols);
const char *text = mkauthor(author, opt_author_cols, opt_author);
+ if (opt_author == AUTHOR_NO)
+ return FALSE;
+
return draw_field(view, LINE_AUTHOR, text, opt_author_cols, trim);
}
}
#define refresh_view(view) load_view(view, OPEN_REFRESH)
+#define reload_view(view) load_view(view, OPEN_RELOAD)
static void
split_view(struct view *prev, struct view *view)
struct tree_entry *entry = line->data;
const char *text[] = {
entry->name,
- opt_author ? entry->author : "",
+ mkauthor(entry->author, opt_author_cols, opt_author),
mkdate(&entry->time, opt_date),
NULL
};
if (*opt_ref || !begin_update(view, opt_cdup, file_argv, flags)) {
const char *blame_cat_file_argv[] = {
- "git", "cat-file", "blob", path, NULL
+ "git", "cat-file", "blob", "%(ref):%(file)", NULL
};
- if (!string_format(path, "%s:%s", opt_ref, opt_file) ||
- !begin_update(view, opt_cdup, blame_cat_file_argv, flags))
+ if (!begin_update(view, opt_cdup, blame_cat_file_argv, flags))
return FALSE;
}
free(blame->commit);
}
- string_format(view->vid, "%s:%s", opt_ref, opt_file);
+ string_format(view->vid, "%s", opt_file);
string_format(view->ref, "%s ...", opt_file);
return TRUE;
string_copy(opt_file, blame->commit->filename);
if (blame->lineno)
view->lineno = blame->lineno;
- refresh_view(view);
+ reload_view(view);
}
break;
string_copy_rev(opt_ref, blame->commit->parent_id);
string_copy(opt_file, blame->commit->parent_filename);
setup_blame_parent_line(view, blame);
- refresh_view(view);
+ reload_view(view);
}
break;
struct branch *branch = line->data;
const char *text[] = {
branch->ref->name,
- branch->author,
+ mkauthor(branch->author, opt_author_cols, opt_author),
NULL
};
struct commit *commit = line->data;
const char *text[] = {
commit->title,
- opt_author ? commit->author : "",
+ mkauthor(commit->author, opt_author_cols, opt_author),
mkdate(&commit->time, opt_date),
NULL
};