index 8fb07bf7db8289600e3f391e3e49400577a58c17..e6e44d3c1938c1a92f29c1ec9cd8b74b3afd13ac 100644 (file)
--- a/tig.c
+++ b/tig.c
char author[75]; /* Author of the commit. */
struct tm time; /* Date from the author ident. */
char filename[128]; /* Name of file. */
+ bool has_previous; /* Was a "previous" line detected. */
};
struct blame {
} else if (match_blame_header("summary ", &line)) {
string_ncopy(commit->title, line, strlen(line));
+ } else if (match_blame_header("previous ", &line)) {
+ commit->has_previous = TRUE;
+
} else if (match_blame_header("filename ", &line)) {
string_ncopy(commit->filename, line, strlen(line));
commit = NULL;
if (!strcmp(blame->commit->id, NULL_ID)) {
struct view *diff = VIEW(REQ_VIEW_DIFF);
const char *diff_index_argv[] = {
- "git", "diff-index", "--root", "--cached",
- "--patch-with-stat", "-C", "-M",
- "HEAD", "--", view->vid, NULL
+ "git", "diff-index", "--patch-with-stat", "-C",
+ "-M", "HEAD", "--", view->vid, NULL
};
+ if (!blame->commit->has_previous) {
+ diff_index_argv[1] = "diff";
+ diff_index_argv[5] = "--";
+ diff_index_argv[6] = "/dev/null";
+ }
+
if (!prepare_update(diff, diff_index_argv, NULL, FORMAT_DASH)) {
report("Failed to allocate diff command");
break;