summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d9f2ad1)
raw | patch | inline | side by side (parent: d9f2ad1)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 23 Jan 2009 11:11:01 +0000 (12:11 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 23 Jan 2009 11:14:50 +0000 (12:14 +0100) |
tig.c | patch | blob | history |
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;