diff options
author | Jonas Fonseca <jonas.fonseca@gmail.com> | 2014-03-14 01:11:54 -0400 |
---|---|---|
committer | Jonas Fonseca <jonas.fonseca@gmail.com> | 2014-03-14 01:15:43 -0400 |
commit | dd3713a7db320b49816676e9423ee031fbac3745 (patch) | |
tree | 08533c44f74ac9d25872486a654b133bfa6c0b97 | |
parent | 25b507937fd66ea14fb2cd67d3904df538f40e69 (diff) |
Fix blame opening from (un)staged changes diff view
When showing the diff of staged or unstaged changes commit opened from
the main view, the commit ID is the magic all-zero SHA (00000...) which
caused git-blame to choke. Detect this so that blame can be opened even
from these diff views.
-rw-r--r-- | src/diff.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -348,7 +348,10 @@ diff_trace_origin(struct view *view, struct line *line) else string_format(ref, "%s^", view->vid); - if (!diff_blame_line(ref, file, lineno, &header, &commit)) { + if (string_rev_is_null(ref)) { + header.id[0] = 0; + header.orig_lineno = lineno; + } else if (!diff_blame_line(ref, file, lineno, &header, &commit)) { report("Failed to read blame data"); return REQ_NONE; } |