-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
.SelectedFile.Name not recognized in commitFiles context #3155
Comments
That's not a bug, You can also use I also just opened a PR for adding difftool support to lazygit, see #3156. I'd be interested in your feedback if you want to test it. I made it so that |
.SelectedCommitFile.Name works. Thanks for the quick response. I'd be happy to test the difftool support. How do I go about getting it? |
By building from source. Install go, clone this repo, check out the |
This works as expected on the individual files, thanks. When I hit Ctrl-T with a directory selected, I get what looks like a netrw diff. I'd have expected to see git difftool run against every committed file in the directory. Also, sometimes even with large commits, I like to run a git difftool on the repository root directory. Is there a way to do that? |
Yeah, that's because of the
Currently not. There's also no way to look at and scroll through the entire diff in lazygit's diff view, something I occasionally miss. But I don't have a good idea for a UX to support this. We could add an additional, artificial hierarchy level for the root so that you can select it, but it would feel a bit strange to be able to collaps it (why would you?). |
I'm sure you'll come up with something good. Lazygit is a great app. Thanks again. BTW, when I say "the repository root directory", I just mean where the .git directory is, as in git rev-parse --git-dir. I often like to diff all of the files for a given commit. |
Yes, I got that. For commits this could be achieved by offering the difftool command not only in the commitFiles context, but also on a commit itself, this would be nicely analogous to how lazygit's diff view shows the diff for the entire commit on the right side. However, this doesn't help when you want to do it for all modified files in your working copy. |
One more thing: I'm unclear on how changes like this get into the master branch. Is it just a matter of waiting for it to happen? |
That's a good question. For this particular case, there are still open questions that need to be answered somehow, and it's unclear how. My comments above were meant as a call for input or discussion (maybe that wasn't clear enough), but all I got was "you'll come up with something good". That doesn't help, really. 😉 In other cases it's often Jesse who just makes a call after hearing all the opinions. He's not around right now (temporarily), so that doesn't work here. I suppose I could just make a decision, but it would likely be to keep the existing behavior (pass |
Ah! I didn't know you were looking for more from me. Here's what I'd like to see:
Does that help? |
Well, not really. 😄 The main open question was related to whether we show a directory diff ( However, that's too many config options, I'd like to avoid adding more than necessary, because the lazygit config system is already unwieldy. So I lean towards keeping it the way it is (with How well this works really depends on the diff tool used. Personally I use Beyond Compare, it does a pretty good job at showing a directory diff. I just tried FileMerge (on Mac, comes with Xcode), and it's terrible. I don't have access to many other diff tools that I could try, so that's one more aspect for which input would be useful. |
--dir-diff is fair enough. I work on a mainframe product that already has too many options as it is, so I understand completely. Ship it! (One way I could go about getting what I need is to make a local branch off of master with my changes to it. Doesn't sound hard.) |
OK thanks, that makes it easier.
It's not quite as easy. The PR still needs a code review, and it doesn't have tests.
I've done this many times, and yes, it can work well, but it can also be annoying at times when you continuously rebase your local stuff onto upstream master and keep getting conflicts. If you're lucky it doesn't happen too often. |
"Ship it!" is an old mainframe quasi-joke that deliberately ignores all of the reviewing and testing and administrative work that everyone knows needs to be done. :) Thanks again for all your help. |
Describe the bug
When I try to use {{ .SelectedFile.Name }} in a custom command in the commitFiles context, I get this error:
template: template:1:96: executing "template" at <.SelectedFile.Name>: nil pointer evaluating *models.File.Name
To Reproduce
Steps to reproduce the behavior:
customCommands:
context: commitFiles
command: 'git difftool {{ .SelectedLocalCommit.Sha }}^..{{ .SelectedLocalCommit.Sha }} -- {{ .SelectedFile.Name }}'
subprocess: true
Expected behavior
See git difftool (in my case, vimdiff) invoked for the selected file.
Screenshots
Not applicable?
Version info:
lazygit --version
commit=cf82e69bbe8ec25facbc354fe61c7ad8a5413ea1, build date=2023-12-09T14:40:36Z, build source=unknown, version=cf82e69b, os=linux, arch=amd64, git version=2.43.0
git --version
git version 2.43.0
Additional context
I tried running lazygit --debug and lazygit --log. Nothing showed up in the log at the time of the error.
Note: please try updating to the latest version or manually building the latest
master
to see if the issue still occurs.The text was updated successfully, but these errors were encountered: