X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tig.c;h=b0032ea67a9fd869b658fa3e984c38007a6250d6;hb=e60ef00ee281973dee588598e199b5913b837050;hp=b1c1bdb93dfa3af5dc02f4fec105d6e209560302;hpb=83ef9f853312f7e4bbc5ef6ba3700f9282e6cb65;p=tig.git diff --git a/tig.c b/tig.c index b1c1bdb..b0032ea 100644 --- a/tig.c +++ b/tig.c @@ -158,19 +158,27 @@ get_author_initials(const char *author) 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; @@ -4125,11 +4133,10 @@ blame_open(struct view *view, enum open_flags flags) 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; } @@ -4151,7 +4158,7 @@ blame_open(struct view *view, enum open_flags flags) 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;