Open petrisch opened 5 months ago
I have no problem with supporting windows, I don't use windows for development myself though so it's hard for me to test, so if you could help out that would be great :)
The issue seems to be with this function: https://github.com/isak102/telescope-git-file-history.nvim/blob/7a8579f8676c82577b0c44cecd2e22f6e23bb117/lua/telescope/_extensions/git_file_history.lua#L106-L109
If it returns false despite being in a git repo then the check has to be altered for windows somehow.
But there are other places in the code which won't work properly on windows aswell I think,
like this:
https://github.com/isak102/telescope-git-file-history.nvim/blob/7a8579f8676c82577b0c44cecd2e22f6e23bb117/lua/telescope/_extensions/git_file_history.lua#L122-L130
I could not find a way to use pipes in new_oneshot_job
without wrapping it in sh -c
, but this will not run on windows
This $()
substitution will also not work:
https://github.com/isak102/telescope-git-file-history.nvim/blob/7a8579f8676c82577b0c44cecd2e22f6e23bb117/lua/telescope/_extensions/git_file_history/actions.lua#L10
@isak102 thanks alot already. If I can spend any free time on this I certainly will!
All I found is that vim.fn.system("git rev-parse --is-inside-work-tree")
maybe should be
vim.fn.system({"git rev-parse --is-inside-work-tree"})
from here:
https://github.com/neovim/neovim/issues/19914
But that didn't solve it, so it is probably not related at all.
Maybe it could have something to do with the newline here? https://github.com/isak102/telescope-git-file-history.nvim/blob/f94fab1d5a51fa28dd95b1a6bd377505dc1a8e82/lua/telescope/_extensions/git_file_history.lua#L108
Try just checking result == "true"
and see if that works.
But the is_git_directory
check is not really needed, it's just to provide some better user feedback if you try to use the plugin in a non-git directory. Without it its just going to show an empty telescope picker
Hm, that didn't do it. Maybe I can spend some time this week on it, but can't promise it...
Ok, so changing back to what your original version was, works with me as well now. Turns out the problem was, that my underlying shell (nushell) doesn't work.
With the default cmd.exe that part works. Which I should have checked in advance, because nushell is special in what it gives back.
Anyway, now I see an empty telescope prompt which is at least progress 😄
And I guess ..finders.new_oneshot_job..
doesn't work as you expected already.
Ok so spending a few minutes on it, I decided to just use nu as shell and this works:
finder = finders.new_oneshot_job({
"nu",
"-c",
"git log --follow --decorate --format='%H %ad%d %s' --date=format:'%Y-%m-%d' --name-only "
.. vim.fn.expand("%")
.. " | awk '{if (!NF) next; if (line) {print line \""
.. SEPARATOR
.. "\" $0; line=\"\"} else {line=$0}}\'",
}, opts),
But that obviously breaks other people and you probably don't want to support X shells.
So maybe next would be a cmd.exe
version since thats whats always there on windows.
However my motivation just dropped for getting into cmd escape characters 😺
I tried bash
, it is ok.
which bash
/usr/bin/bash
C:\Program Files\Git\usr\bin
Hi @peter-lyr
Since Git has to be installed anyway, this be ok. But it didn't work for me with the inital 'sh', did that work for you, or is it only for bash?
Hi
Absolutely great plugin!
Feel free to ignore and close it immediately if this is not intendet to be supported on this *** platform: I have awk in the path, but I get this when trying
:Telescope git_file_history
:Which just tells me, that probably the file path is not windows compatible. I can dig into deeper maybe next week.