commit - 00a838fa1e986f3c106d04320ffcffe903899e08
commit + 6d9fbc005a1df03c13130148b900360d76426ff4
blob - b730cfbd5dd10a6e5ccb16334a60dcc20793a155
blob + 66799dbd7b848d6c94d915932f14a15e397ee0c7
--- tog/tog.c
+++ tog/tog.c
{
const struct got_error *err = NULL;
char *logmsg0 = NULL, *logmsg = NULL;
- char *newline;
+ char *author0 = NULL, *author = NULL;
+ char *newline, *smallerthan;
char *line = NULL;
- char *id_str;
+ char *id_str = NULL;
size_t len;
err = got_object_id_str(&id_str, id);
if (err)
return err;
logmsg0 = strdup(commit->logmsg);
- if (logmsg0 == NULL)
- return got_error_from_errno();
+ if (logmsg0 == NULL) {
+ err = got_error_from_errno();
+ goto done;
+ }
logmsg = logmsg0;
while (*logmsg == '\n')
logmsg++;
newline = strchr(logmsg, '\n');
- if (newline != NULL)
+ if (newline)
*newline = '\0';
- if (asprintf(&line, "%.8s %.35s %s", id_str, commit->author,
- logmsg) == -1) {
+ author0 = strdup(commit->author);
+ if (author0 == NULL) {
err = got_error_from_errno();
goto done;
}
+ author = author0;
+ smallerthan = strchr(author, '<');
+ if (smallerthan)
+ *smallerthan = '\0';
+ else {
+ char *at = strchr(author, '@');
+ if (at)
+ *at = '\0';
+ }
+ if (asprintf(&line, "%.8s %.20s %s", id_str, author, logmsg) == -1) {
+ err = got_error_from_errno();
+ goto done;
+ }
+
waddstr(tog_log_view.window, line);
len = strlen(line);
while (len < COLS - 1) {
waddch(tog_log_view.window, '\n');
done:
free(logmsg0);
+ free(author0);
free(line);
+ free(id_str);
return err;
}
struct commit_queue_entry {