"git log --no-color --cc --stat -n100 %s 2>/dev/null"
#define TIG_MAIN_CMD \
- "git log --no-color --topo-order --boundary --pretty=raw %s 2>/dev/null"
+ "git log --no-color --topo-order --parents --boundary --pretty=raw %s 2>/dev/null"
#define TIG_TREE_CMD \
"git ls-tree %s %s"
{
char *altargv[1024];
int altargc = 0;
- char *subcommand = NULL;
+ char *subcommand;
int i;
- for (i = 1; i < argc; i++) {
- char *opt = argv[i];
+ if (argc <= 1)
+ return TRUE;
- if (!strcmp(opt, "log") ||
- !strcmp(opt, "diff")) {
- subcommand = opt;
- opt_request = opt[0] == 'l'
- ? REQ_VIEW_LOG : REQ_VIEW_DIFF;
- warn("`tig %s' has been deprecated", opt);
- break;
- }
+ subcommand = argv[1];
+ if (!strcmp(subcommand, "status")) {
+ opt_request = REQ_VIEW_STATUS;
+ if (argc > 2)
+ warn("ignoring arguments after `%s'", subcommand);
+ return TRUE;
- if (!strcmp(opt, "show")) {
- subcommand = opt;
- opt_request = REQ_VIEW_DIFF;
- break;
- }
+ } else if (!strcmp(subcommand, "show")) {
+ opt_request = REQ_VIEW_DIFF;
- if (!strcmp(opt, "status")) {
- subcommand = opt;
- opt_request = REQ_VIEW_STATUS;
- break;
- }
+ } else if (!strcmp(subcommand, "log") || !strcmp(subcommand, "diff")) {
+ opt_request = subcommand[0] == 'l'
+ ? REQ_VIEW_LOG : REQ_VIEW_DIFF;
+ warn("`tig %s' has been deprecated", subcommand);
+
+ } else {
+ subcommand = NULL;
+ }
+
+ for (i = 1 + !!subcommand; i < argc; i++) {
+ char *opt = argv[i];
if (opt[0] && opt[0] != '-')
break;
warn("`%s' has been deprecated", opt);
}
- /* Check that no 'alt' arguments occured before a subcommand. */
- if (subcommand && i < argc && altargc > 0)
- die("unknown arguments before `%s'", argv[i]);
-
if (!isatty(STDIN_FILENO)) {
opt_request = REQ_VIEW_PAGER;
opt_pipe = stdin;
- } else if (opt_request == REQ_VIEW_STATUS) {
- if (argc - i > 1)
- warn("ignoring arguments after `%s'", argv[i]);
-
} else if (i < argc || altargc > 0) {
int alti = 0;
size_t buf_size;
if (opt_request == REQ_VIEW_MAIN)
/* XXX: This is vulnerable to the user overriding
* options required for the main view parser. */
- string_copy(opt_cmd, "git log --no-color --pretty=raw --boundary");
+ string_copy(opt_cmd, "git log --no-color --pretty=raw --boundary --parents");
else
- string_copy(opt_cmd, "git");
+ string_format(opt_cmd, "git %s", subcommand);
buf_size = strlen(opt_cmd);
while (buf_size < sizeof(opt_cmd) && alti < altargc) {
opt_cmd[buf_size] = 0;
}
- if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8"))
- opt_utf8 = FALSE;
-
return TRUE;
}
(view == display[0] || view == display[1])
static int
-draw_text(struct view *view, const char *string, int max_len, int col,
+draw_text(struct view *view, const char *string, int max_len,
bool use_tilde, int tilde_attr)
{
int len = 0;
} else {
int tilde_attr = get_line_attr(LINE_MAIN_DELIM);
- draw_text(view, text, view->width, 0, TRUE, tilde_attr);
+ draw_text(view, text, view->width, TRUE, tilde_attr);
}
return TRUE;
return FALSE;
}
- draw_text(view, text, view->width, 0, TRUE, tilde_attr);
+ draw_text(view, text, view->width, TRUE, tilde_attr);
return TRUE;
}
if (view->width < 5)
return TRUE;
- draw_text(view, status->new.name, view->width - 5, 5, TRUE, tilde_attr);
+ draw_text(view, status->new.name, view->width - 5, TRUE, tilde_attr);
return TRUE;
}
struct ref **refs; /* Repository references. */
chtype graph[SIZEOF_REVGRAPH]; /* Ancestry chain graphics. */
size_t graph_size; /* The width of the graph array. */
+ bool has_parents; /* Rewritten --parents seen. */
};
/* Size of rev graph with no "padding" columns */
int n;
timelen = strftime(buf, sizeof(buf), DATE_FORMAT, &commit->time);
- n = draw_text(
- view, buf, view->width - col, col, FALSE, tilde_attr);
- draw_text(
- view, " ", view->width - col - n, col + n, FALSE,
- tilde_attr);
+ n = draw_text(view, buf, view->width - col, FALSE, tilde_attr);
+ draw_text(view, " ", view->width - col - n, FALSE, tilde_attr);
col += DATE_COLS;
wmove(view->win, lineno, col);
max_len = view->width - col;
if (max_len > AUTHOR_COLS - 1)
max_len = AUTHOR_COLS - 1;
- draw_text(
- view, commit->author, max_len, col, TRUE, tilde_attr);
+ draw_text(view, commit->author, max_len, TRUE, tilde_attr);
col += AUTHOR_COLS;
if (col >= view->width)
return TRUE;
else
wattrset(view->win, get_line_attr(LINE_MAIN_REF));
- col += draw_text(
- view, "[", view->width - col, col, TRUE,
- tilde_attr);
- col += draw_text(
- view, commit->refs[i]->name, view->width - col,
- col, TRUE, tilde_attr);
- col += draw_text(
- view, "]", view->width - col, col, TRUE,
- tilde_attr);
+ col += draw_text(view, "[", view->width - col, TRUE, tilde_attr);
+ col += draw_text(view, commit->refs[i]->name, view->width - col,
+ TRUE, tilde_attr);
+ col += draw_text(view, "]", view->width - col, TRUE, tilde_attr);
if (type != LINE_CURSOR)
wattrset(view->win, A_NORMAL);
- col += draw_text(
- view, " ", view->width - col, col, TRUE,
- tilde_attr);
+ col += draw_text(view, " ", view->width - col, TRUE, tilde_attr);
if (col >= view->width)
return TRUE;
} while (commit->refs[i++]->next);
if (type != LINE_CURSOR)
wattrset(view->win, get_line_attr(type));
- col += draw_text(
- view, commit->title, view->width - col, col, TRUE, tilde_attr);
-
+ draw_text(view, commit->title, view->width - col, TRUE, tilde_attr);
return TRUE;
}
commit->refs = get_refs(commit->id);
graph->commit = commit;
add_line_data(view, commit, LINE_MAIN_COMMIT);
+
+ while ((line = strchr(line, ' '))) {
+ line++;
+ push_rev_graph(graph->parents, line);
+ commit->has_parents = TRUE;
+ }
return TRUE;
}
switch (type) {
case LINE_PARENT:
+ if (commit->has_parents)
+ break;
push_rev_graph(graph->parents, line + STRING_SIZE("parent "));
break;
if (!opt_git_dir[0])
die("Not a git repository");
+ if (*opt_encoding && strcasecmp(opt_encoding, "UTF-8"))
+ opt_utf8 = FALSE;
+
if (*opt_codeset && strcmp(opt_codeset, opt_encoding)) {
opt_iconv = iconv_open(opt_codeset, opt_encoding);
if (opt_iconv == ICONV_NONE)