-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
"log_follow_rename": true
setting works properly for show_file_at_commit
, checkout_file_at_commit
#1750
base: master
Are you sure you want to change the base?
Conversation
…ckout_file_at_commit
commit_hash = self._commit_hash | ||
file_path = self._file_path | ||
|
||
if commit_hash and file_path and self.savvy_settings.get("log_follow_rename"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point all three predicates should be True
all the time if I'm reading this correctly.
There is also
GitSavvy/core/commands/log_graph.py
Lines 2702 to 2704 in 8afe2de
def checkout_file_at_commit(self, commit_hash, file_path): | |
self.checkout_ref(commit_hash, fpath=file_path) | |
util.view.refresh_gitsavvy_interfaces(self.window) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the three expressions in the if
statement, if commit_hash and file_path and self.savvy_settings.get("log_follow_rename"):
?
Type checker says file_path
is Unknown | None
in line 254 above, and self.filename_at_commit
takes (str, str)
, so I figured I'd just make sure both were truthy
As for self.savvy_settings.get("log_follow_rename")
, that's a user setting that's not guaranteed to be truthy in general, right?
Agreed on making same patch in log_graph
.py` module, I'll do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for self.savvy_settings.get("log_follow_rename"), that's a user setting that's not guaranteed to be truthy in general, right?
Ah right, looks like log_follow_rename
can be False
still, but self._commit_hash
is always truthy here and self._file_path
too otherwise the menu item would not appear (see def update_actions(self)
).
core/commands/show_file_at_commit.py
Outdated
else: | ||
filename_at_commit = file_path | ||
|
||
text = self.get_file_content_at_commit(filename_at_commit, commit_hash) | ||
render(view, text, position) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the changes for "show_file_at_commit" do work. Not sure I do get them though. What confuses me is that we get the filename_at_commit
here but don't use it on L103 and L105 too. Is that intentional?
Also the whole show_file_at_commit
view has [p]revious
and [n]ext
handlers, starting at L201 below. Do they just work or did you miss them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize there's an error in the code I wrote. It should be checking self.savvy_settings.get("log_follow_rename"):
, not self.savvy_settings.get("blame_follow_rename"):
The code works for me in both cases, but that's because I have both of these enabled in my GitSavvy settings
"log_follow_rename": true,
"blame_follow_rename": true,
I just fixed this
What confuses me is that we get the filename_at_commit here but don't use it on L103 and L105 too
Thanks for catching this, I just fixed this as well
Also the whole show_file_at_commit view has [p]revious and [n]ext handlers, starting at L201 below. Do they just work or did you miss them?
I tried making this code work and couldn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally very welcome change. I think the show_file_at_commit
view is more complicated to do right though. Maybe you should split this PR in two; esp. as the checkout
part looks almost trivial.
I think the bug you found in the I think having |
I actually wonder why the defaults for |
Actually |
"log_follow_rename": true
setting works properly forshow_file_at_commit
,checkout_file_at_commit
filename_at_commit
function, in the same way it's used here inblame_file_atcommit
show_file_at_commit
andcheckout_file_at_commit
work as expected, for files that have been renamed and files that haven't been renamed