SRombauts / UEGitPlugin

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

Fix LFS auto-push failure because out of date, via auto-pull #136

Closed sinbad closed 4 years ago

sinbad commented 4 years ago

There's a common problem if you use the LFS locking mode with more than one person. Because Submit automatically pushes so that it can unlock, if that push fails you're left in a state where you need to resolve it yourself. This means:

  1. Pull
  2. Push
  3. Manually unlock (because Push doesn't do it - I may submit another PR for that)

This is awkward when most of the time the changes are unrelated, git just won't let you push. And since Unlock isn't exposed in UE4 you either have to do it manually, or know that Revert will do it (even though you haven't got any local changes).

In 99% of cases where locking is applied, you could just auto-pull to resolve then try again. So that's what this PR does. In the case of a failed pull, this change:

  1. Checks whether the failure was a non-fast forward error
  2. If so, it checks whether there are any other modifications, and stashes if needed
  3. Performs a pull --rebase (since that's the default in the Pull menu)
  4. Re-tries the push
  5. Applies the stash again (even in the case of further push failure)

This is a big QoL improvement for us, hope you like it.

SRombauts commented 4 years ago

Thank you again!