monoblaine / wine_git

A native git wrapper for Wine (Specifically for GitExtensions running under Wine)
0 stars 0 forks source link

How to get this working? #1

Open houmain opened 1 month ago

houmain commented 1 month ago

Hi, I just gave your v0.2.3 release a try, since I am also very interested in running gitextensions on Linux! Unfortunately I could not get it to work. How does it even work? I found and hopefully correctly set the paths in settings.ini and worker.sh. Do I have to tell gitextensions to use wine_git.exe instead of git.exe? That's what I tried. I renamed the file, since gitextension did not allow to select a file with a different name. But after that gitextensions simply exited... As you can see I am clueless.

Calling wine_git gave me:

C:\wine_git>wine_git
Unhandled Exception: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
   at System.String.ThrowSubstringArgumentOutOfRange(Int32, Int32) + 0x4d
   at System.String.Substring(Int32, Int32) + 0x44
   at WineGit.Program.Main() + 0x8c
   at wine_git!<BaseAddress>+0x13b0c8

And worker.sh:

~/.wine/drive_c/wine_git …
➜ ./worker.sh 123   
./worker.sh: line 24: /mnt/LocalStorage/Home/houdini/.wine/drive_c/wine_git/tmp/out_123: No such file or directory
touch: cannot touch '/mnt/LocalStorage/Home/houdini/.wine/drive_c/wine_git/tmp/lock_123': No such file or directory

Thanks for your help!

monoblaine commented 1 month ago

Hey @houmain, thanks for the feedback!

I'm afraid the process name is currently (for no obvious reason) hard-coded, and that explains the ArgumentOutOfRangeException:

https://github.com/monoblaine/wine_git/blob/20756bfbf31dd5232a2ec40ba4a9b36c61e997d2/WineGit/Program.cs#L26-L28

GitExtensions should have no problems with the name of the git executable. The following pic shows my configuration:

image

In your case, the worker.sh spits "cannot touch" errors probably because the tmp folder does not exist. (That's my fault, I should've added the folder to the repository.)

In short, can you try again with the following directory structure?

your_wine_git_folder
├── tmp (folder)
├── settings.ini
├── wine_git.exe
└── worker.sh

Then open a terminal and cd to a git repository folder and try running the following command:

wine <path to your wine_git folder>/wine_git.exe status

If it shows the output of git status, then GitExtensions should be fine with that.

houmain commented 1 month ago

Thank you very much, now I got it working and it looks very promising!

First I had to create a copy of wine_git.exe to git.exe, so I could select it in the setup wizard (which is mandatory before the main settings dialog even appears): Screenshot_2024-08-26_06-48-15 Screenshot_2024-08-26_06-48-56 In the future I can just insert this directly in the GitExtensions.settings file:

  <item>
    <key>
      <string>gitcommand</string>
    </key>
    <value>
      <string>C:\wine_git\wine_git.exe</string>
    </value>
  </item>

I tried creating a tag, which worked, but when I tried to delete the tag, refreshing the view froze (I don't know if there is anything you could do about it). Screenshot_2024-08-26_07-17-12

A later attempt to fetch and prune failed with this error (again, I do not know if it is related to wine_git): Screenshot_2024-08-26_07-03-51

monoblaine commented 1 month ago

I'm happy to hear that it (kind of) worked!

I tried creating a tag, which worked, but when I tried to delete the tag, refreshing the view froze (I don't know if there is anything you could do about it).

This smells like a race condition. The worker might be touching the lock file before even wine_git.exe starts monitoring it. I'll see what I can do about it.

A later attempt to fetch and prune failed with this error (again, I do not know if it is related to wine_git):

Is this a one-time problem or does it happen all the time?

By the way, (completely irrelevant to the subject) may I ask you to occasionally check the task manager for processes that include the following command?

git mergetool --tool-help=diff

In my case, for each GitExtensions instance there was a process like this, it was stuck and I had to kill them manually. In the end, I couldn't find the reason and I removed the code that executes this command from GitExtensions. You can check my fork if you're interested:

https://github.com/monoblaine/gitextensions/commit/b10a19ce3e7d972d1844dca170283ac8152969c6

Another issue I've experienced is also visible in your second last screenshot: The commit info is collapsed into a single line. I did some research and tried random things but was not able to find the reason. I guess it's a bug with Wine's handling of RichTextBox content. My workaround was to use SetXHTMLTextAsPlainText instead of SetXHTMLText. This change disables the links inside the commit info but makes everything visible at least. You can see the relevant change here: https://github.com/monoblaine/gitextensions/commit/685a826a6637380138f3de041c26aa40d3c822ec

houmain commented 3 weeks ago

The worker might be touching the lock file before even wine_git.exe starts monitoring it. I'll see what I can do about it.

Great, thanks! With version 0.3.0 I think it is better, but not perfect yet. I experienced a deadlock when creating a branch.

Is this a one-time problem or does it happen all the time?

It is not easily reproducible but also not a one-time issue. Right now it happened while cherry picking a commit: Screenshot_2024-09-01_16-50-33

By the way, (completely irrelevant to the subject) may I ask you to occasionally check the task manager for processes that include the following command?

I did not see this yet. I am still using the unpatched version 4.2.1.