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

Any idea if it's possible to use for a custom .git dir on Windows? #7

Open
ian-h-chamberlain opened this issue Oct 16, 2024 · 6 comments

Comments

@ian-h-chamberlain
Copy link

Hi, I'm starting to migrate to Windows for work (😭) and was trying to see if I could still use Fork for Windows to manage my dotfiles like I used to on macOS (for which Fork works beautifully)...

Do you know of a way to set this up so that Fork detects forkgit as a real git instance, such that it would work the same as it does on macOS? I tried a few different things, none of which seem to work so far:

  • Wrap forkgit's bin/git script into a .exe, copy over some Git helpers like bash.exe and sh.exe
  • Create a shortcut called git.exe to the wrapper script
  • ???

Admittedly, I am a total novice when it comes to Windows and in particular I am not sure what Fork is looking for when selecting a Git instance (other than it must be a *.exe according to the file dialog). Nothing I have tried so far has made the instance "stick", so I just thought I'd ask to see if you have any ideas or thoughts about it (maybe some OS-specific stuff in the script that could be made more portable? Idk)

Thanks! If I figure anything out I will try to document it here / open a PR, in case others are trying to do the same thing!

@brechtm
Copy link
Owner

brechtm commented Oct 18, 2024

Wrap forkgit's bin/git script into a .exe, copy over some Git helpers like bash.exe and sh.exe

I don't think you need bash or sh. How are you "wrapping" the git script in an exe?

I think you could use something like py2exe or Nuitka to compile fotkgit's git to an executable. Have you tried that?

@brechtm
Copy link
Owner

brechtm commented Oct 19, 2024

I experimented a bit and got it to work for the local mode (setting git-dir in .forkgit) so far. I'll try to post details soon!

@brechtm
Copy link
Owner

brechtm commented Oct 19, 2024

Please check out the windows branch. You'll need to install pyinstaller and run devel_exe.ps1 in a PowerShell terminal. That should build bin/git.exe, which can be selected as a Git instance in Fork.

@ian-h-chamberlain
Copy link
Author

Wow, thanks for the quick response and implementation! I had been looking at implementing it with something like ps2exe to avoid bundling a whole python interpreter in the EXE, but since you've already got it working this definitely seems easier to start with!

I tried this out and it seems to work well for native Windows, but the performance was very slow when trying to use it with a repository stored on the WSL filesystem, since git.exe accessing files inside WSL is known to be slow (see e.g. https://markentier.tech/posts/2020/10/faster-git-under-wsl2/)

I tried hacking around your changes to improve it specifically for WSL and landed on this: windows...ian-h-chamberlain:forkgit:windows
There's probably some overhead from calling wsl.exe for every git command, but it seems a lot faster vs git.exe at least. I'm happy to clean it up a bit and make a PR if you'd like.

Thanks again, this should really help me while trying to migrate all of my dotfiles over to Windows!

@brechtm
Copy link
Owner

brechtm commented Oct 20, 2024

I'm happy to clean it up a bit and make a PR if you'd like.

Yes, please do. I'll merge it into the windows branch. I can test drive the changes on MacOS to see whether they break anything before I merge it into the master branch.

You don't happen to be interested in trying to get remote (SSH) repositories working in Windows by any chance? 😉

@brechtm
Copy link
Owner

brechtm commented Oct 21, 2024

You don't happen to be interested in trying to get remote (SSH) repositories working in Windows by any chance? 😉

I wanted to see how easy this would be, and it turns out: very! 😄
The windows branch will now also handle remote repositories. You'll need to install Fork 1.86 (and immediately disable auto-updating) and create an empty .git/config file locally (in addition to the .forkgit configuration).

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

No branches or pull requests

2 participants