SRombauts / UEGitPlugin

Unreal Engine 5 Git LFS 2 Source Control Plugin (beta)
http://srombauts.github.io/UEGitPlugin
MIT License
808 stars 165 forks source link

Fix issue where locking a file would fail on Linux #55

Closed CraftedCart closed 6 years ago

CraftedCart commented 6 years ago

When locking a file (At least on Linux), it would fail with the following message in the log

Failed to call git rev-parse --show-toplevel: exit status 128
[2017.11.27-00.38.26:982][724]LogSourceControl: Warning: RunLfsCommand(lfs lock) ReturnCode=2:

git lfs will error with that message if the current working directory is not within the git directory. For whatever reason passing the directory as OptionalWorkingDirectory in CreateProc doesn't seem to work.

So I modified the git command to take the git directory with the -C argument. Now when locking a file, the plugin will build a command like `git -C "/home/user/Unreal Projects/AwesomeProject lfs lock path/to/file.uasset".

SRombauts commented 6 years ago

Thanks for this @CraftedCart.

The lock command is working on my Windows install, so it looks like a difference of implementation under Linux.

I didn't know of this "-C" command line flag, perhaps was it not present under git 1.9.x when I started this Git Plugin...

SRombauts commented 6 years ago

This option appeared in git 1.8.5 (Q4 2013, see RelNotes):

Just like "make -C ", "git -C ..." tells Git to go there before doing anything else.

So I can safely assume that anyone using the Git plugin should now have a more recent Git version (which was still quite new when I started).

SRombauts commented 6 years ago

Hum, the fact is that FLinuxPlatformProcess::CreateProc() does not use the OptionalWorkingDirectory!

SRombauts commented 6 years ago

Ok, so I will merge your patch "as-is". I will refactor and re-test it properly later when I have more time.

Thanks again!