summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8897e66)
raw | patch | inline | side by side (parent: 8897e66)
author | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 18 Oct 2007 19:26:05 +0000 (21:26 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 18 Oct 2007 19:26:25 +0000 (21:26 +0200) |
Relying only on the diff plumbing seems to be the safer thing to do.
tig.c | patch | blob | history |
index f6bb9f3ef64d4e3cde92a9a7b557f79326931498..fbc65b911894f1a598997ef0728b97f29567ce32 100644 (file)
--- a/tig.c
+++ b/tig.c
#define STATUS_LIST_OTHER_CMD \
"git ls-files -z --others --exclude-per-directory=.gitignore"
-#define STATUS_DIFF_SHOW_CMD \
- "git diff --no-color --root --patch-with-stat --find-copies-harder -B -C %s -- %s 2>/dev/null"
+#define STATUS_DIFF_INDEX_SHOW_CMD \
+ "git diff-index --root --patch-with-stat --find-copies-harder -B -C --cached HEAD -- %s 2>/dev/null"
+
+#define STATUS_DIFF_FILES_SHOW_CMD \
+ "git diff-files --root --patch-with-stat --find-copies-harder -B -C -- %s 2>/dev/null"
/* First parse staged info using git-diff-index(1), then parse unstaged
* info using git-diff-files(1), and finally untracked files using
switch (line->type) {
case LINE_STAT_STAGED:
- if (!string_format_from(opt_cmd, &cmdsize, STATUS_DIFF_SHOW_CMD,
- "--cached", path))
+ if (!string_format_from(opt_cmd, &cmdsize,
+ STATUS_DIFF_INDEX_SHOW_CMD, path))
return REQ_QUIT;
if (status)
info = "Staged changes to %s";
break;
case LINE_STAT_UNSTAGED:
- if (!string_format_from(opt_cmd, &cmdsize, STATUS_DIFF_SHOW_CMD,
- "", path))
+ if (!string_format_from(opt_cmd, &cmdsize,
+ STATUS_DIFF_FILES_SHOW_CMD, path))
return REQ_QUIT;
if (status)
info = "Unstaged changes to %s";