jonas/tig

[Bug] `tig blame --reverse` get the wrong revision of file

liming01 opened this issue · 2 comments

When I use tig blame --reverse to find which commit deleted a line?, I found that tig gets the wrong file revision. e.g.

git blame --reverse START_SHA..HEAD file.ext can get file.ext @ START_SHA, while
tig blame --reverse START_SHA..HEAD file.ext can get file.ext @ HEAD

--reverse is swallowed by command line parsing, we need to add it back in blame arguments. Would this work for you ?

diff --git a/src/blame.c b/src/blame.c
index b9e15314..43af804f 100644
--- a/src/blame.c
+++ b/src/blame.c
@@ -90,6 +90,9 @@ blame_open(struct view *view, enum open_flags flags)
                        opt_cmdline_args = NULL;
                }

+               if (opt_commit_order == COMMIT_ORDER_REVERSE)
+                       argv_append(&opt_blame_options, "--reverse");
+
                /*
                 * flags (like "--max-age=123") and bottom limits (like "^foo")
                 * will be passed as-is, and retained even if we re-blame from

Hi @koutcher,

This fix works fine in this case.
Thanks a lot!