Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
liming01 opened this issue Nov 1, 2023 · 2 comments
Closed

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

liming01 opened this issue Nov 1, 2023 · 2 comments

Comments

@liming01
Copy link

liming01 commented Nov 1, 2023

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

@koutcher
Copy link
Collaborator

koutcher commented Nov 1, 2023

--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

@liming01
Copy link
Author

liming01 commented Nov 2, 2023

Hi @koutcher,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants