summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a4927c1)
raw | patch | inline | side by side (parent: a4927c1)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 17 Aug 2007 20:47:33 +0000 (22:47 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 17 Aug 2007 20:47:33 +0000 (22:47 +0200) |
... except untracked files.
tig.c | patch | blob | history |
index b9c10abe8b020920ddad8bc0049a0372ed976752..6a50972692f783540a962b8349fb5f01a24dd320 100644 (file)
--- a/tig.c
+++ b/tig.c
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] &&
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;