From: Jeff King Date: Thu, 10 Jun 2010 01:27:27 +0000 (-0400) Subject: Improve parent blame to handle line-jumping for renames better X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=47f8cdf12413e6c4a6d3a7082b2ea282381c068d;p=tig.git Improve parent blame to handle line-jumping for renames better ... by using git diff to compare directly the current and parent blob. Signed-off-by: Jonas Fonseca --- diff --git a/tig.c b/tig.c index c2417bf..dd155e3 100644 --- a/tig.c +++ b/tig.c @@ -5110,16 +5110,20 @@ check_blame_commit(struct blame *blame, bool check_null_id) static void setup_blame_parent_line(struct view *view, struct blame *blame) { + char from[SIZEOF_REF + SIZEOF_STR]; + char to[SIZEOF_REF + SIZEOF_STR]; const char *diff_tree_argv[] = { - "git", "diff-tree", "-U0", blame->commit->id, - "--", blame->commit->filename, NULL + "git", "diff", "--no-textconv", "--no-extdiff", "--no-color", + "-U0", from, to, "--", NULL }; struct io io; int parent_lineno = -1; int blamed_lineno = -1; char *line; - if (!io_run(&io, IO_RD, NULL, diff_tree_argv)) + if (!string_format(from, "%s:%s", opt_ref, opt_file) || + !string_format(to, "%s:%s", blame->commit->id, blame->commit->filename) || + !io_run(&io, IO_RD, NULL, diff_tree_argv)) return; while ((line = io_get(&io, '\n', TRUE))) {