SRombauts / UEPlasticPlugin

Plastic SCM Plugin for Unreal Engine
http://srombauts.github.io/UEPlasticPlugin
146 stars 28 forks source link

Space in project path prevents proper initialization #102

Closed mikeseese closed 2 years ago

mikeseese commented 2 years ago

When trying to initialize the source control provider on v1.5.1, it fails to recognize it as a workspace if there's a space in any of the ancestor directories. You can see here that D:/Creative/Kindred Games/Workspaces/SwordsnMagic2022 gets interpreted as D:/Created/Kindred, effectively ignoring the rest of the path.

image

SRombautsU commented 2 years ago

Ouch, thanks for reporting! I think that it would be a regression, since there was another issue on the same theme that I closed some time ago IIRC.

edit: https://github.com/SRombauts/UE4PlasticPlugin/issues/67 Space in repository name prevents History from working #67 (two years ago)

SRombautsU commented 2 years ago

Hello @seesemichaelj,

I tried to reproduce

  1. first with the old plugin 1.4.6 in-engine (works great)
  2. then with the new version 1.5.1 integrated into ue5-main for upcoming UE5.1 release (works great)
  3. then with the master 1.5.1+dev branch... and it works all the same with space in a workspace!

So I dug it a bit more, and if I erase or rename the .plastic/ directory in the workspace I end up with the same error message as you, I think. Could you check your own logs?

LogSourceControl: Warning: RunCommand: 'getworkspacefrompath C:/Creative/Kindred Games/Workspaces/SwordsnMagic2021/ --format={0}' (in 0.002s) output (44 chars): C:/Creative/Kindred is not in a workspace.

If this is the issue you are seeing, I think it's actually only an issue with the error message, because it wasn't able to find a workspace and tried to work up the path, but returned a truncated path in the error message

SRombautsU commented 2 years ago

When I wrote "works great" it means I was able to create new projects with a space in the path, add them to source control, and then restart the project and confirm it was all working correctly

But I could reproduce the truncated error message using the "cm" command line interface, and then fix it by adding double quotes around the path:

C:\Creative\Kindred Games\Workspaces\SwordsnMagic2022>cm getworkspacefrompath C:\Creative\Kindred Games\Workspaces\SwordsnMagic2022
C:\Creative\Kindred is not in a workspace.

C:\Creative\Kindred Games\Workspaces\SwordsnMagic2022>cm getworkspacefrompath "C:\Creative\Kindred Games\Workspaces\SwordsnMagic2022"
C:\Creative\Kindred Games\Workspaces\SwordsnMagic2022 is not in a workspace.
SRombauts commented 2 years ago

With the fix provided in #103 I get the proper error message:

LogSlate: Window 'Source Control Login' being destroyed
LogSourceControl: IssueAsynchronousCommand: Connect
LogSourceControl: Verbose: RunCommand: 'getworkspacefrompath "C:/Creative/Kindred Games/Workspaces/SwordsnMagic2021/" --format={0}' (91 chars, 0 files)
LogSourceControl: Warning: RunCommand: 'getworkspacefrompath "C:/Creative/Kindred Games/Workspaces/SwordsnMagic2021/" --format={0}' (in 0.002s) output (79 chars):
C:/Creative/Kindred Games/Workspaces/SwordsnMagic2021/ is not in a workspace.
LogSourceControl: Verbose: RunCommand: cumulated time spent in shell: 1.897s (count 5)
SourceControl: Error: C:/Creative/Kindred Games/Workspaces/SwordsnMagic2021/ is not in a workspace.

And as expected I can connect to a workspace with a space in the path

If you are willing to test it please have a go, else I'll have it reviewed in due time :)

Cheers! Sébastien

mikeseese commented 2 years ago

A couple of things to digest here:

While the initial error was from a colleague, I was able to reproduce it today without deleting .plastic:

image

image

When opening the Output Log however, I see more context about the warning:

LogSourceControl: IssueAsynchronousCommand: Connect
LogSourceControl: Warning: RunCommand: 'getworkspacefrompath D:/Kindred Games/SnM --format={0}' (in 0.004s) output (35 chars):
D:/Kindred is not in a workspace.
SourceControl: Error: D:/Kindred is not in a workspace.
LogSourceControl: Connect processed in 0.009s
SourceControl: Error: Failed to enable Plastic SCM source control. You need to initialize the project as a Plastic SCM repository first.

So great, looks like #103 will fix that.

So before testing #103, I tested master to make sure I got the same error as a control test since I'm not really sure which commit of the plugin is being used (because I wasn't the one to add it to source control in this project).

Regardless, master at the time of writing this (ba734c6) does fail, so I'm not sure why you couldn't reproduce the error.

Now testing #103, I am able to connect to source control with no issue. So I guess either way, #103 fixes the problem even if you can't reproduce the problem haha.

SRombauts commented 2 years ago

Hi, thanks for testing this all over again. Yes I agree it is strange, so I did test back and force, using both the exact path you provided or the default one from Users//Documents/Unreal Projects/ I think that there is probably some difference in our Plastic SCM environment, either the exact version we are using, using perhaps even a different dot net runtime since it was changed quite recently.

Nevertheless, it was indeed a bug calling this command without the double quotes, so fixing it is a no brainer :)

mikeseese commented 2 years ago

Fixed by #103