summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Fonseca <jonas.fonseca@gmail.com>2014-03-14 01:11:54 -0400
committerJonas Fonseca <jonas.fonseca@gmail.com>2014-03-14 01:15:43 -0400
commitdd3713a7db320b49816676e9423ee031fbac3745 (patch)
tree08533c44f74ac9d25872486a654b133bfa6c0b97
parent25b507937fd66ea14fb2cd67d3904df538f40e69 (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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index 1e7460b0..b13cbd79 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -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;
}