From: Jonas Fonseca Date: Fri, 17 Aug 2007 20:47:33 +0000 (+0200) Subject: status: make it possible to see all changes for a status section X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4e8159cf403aaea82fa281f8a37e40b52ab67e2e;p=tig.git status: make it possible to see all changes for a status section ... except untracked files. --- diff --git a/tig.c b/tig.c index b9c10ab..6a50972 100644 --- a/tig.c +++ b/tig.c @@ -3024,16 +3024,17 @@ static bool status_enter(struct view *view, struct line *line) { struct status *status = line->data; - char path[SIZEOF_STR]; + char path[SIZEOF_STR] = ""; char *info; size_t cmdsize = 0; - if (!status || line->type == LINE_STAT_NONE) { - report("No file has been chosen"); + if (line->type == LINE_STAT_NONE || + (!status && line[1].type == LINE_STAT_NONE)) { + report("No file to diff"); return TRUE; } - if (sq_quote(path, 0, status->name) >= sizeof(path)) + if (status && sq_quote(path, 0, status->name) >= sizeof(path)) return FALSE; if (opt_cdup[0] && @@ -3046,19 +3047,31 @@ status_enter(struct view *view, struct line *line) if (!string_format_from(opt_cmd, &cmdsize, STATUS_DIFF_SHOW_CMD, "--cached", path)) return FALSE; - info = "Staged changes to %s"; + if (status) + info = "Staged changes to %s"; + else + info = "Staged changes"; break; case LINE_STAT_UNSTAGED: if (!string_format_from(opt_cmd, &cmdsize, STATUS_DIFF_SHOW_CMD, "", path)) return FALSE; - info = "Unstaged changes to %s"; + if (status) + info = "Unstaged changes to %s"; + else + info = "Unstaged changes"; break; case LINE_STAT_UNTRACKED: if (opt_pipe) return FALSE; + + if (!status) { + report("No file to show"); + return TRUE; + } + opt_pipe = fopen(status->name, "r"); info = "Untracked file %s"; break;