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

error in post-checkout hook when switching from master to develop branch #1

Open
MBrandt-NASA opened this issue Nov 30, 2016 · 2 comments

Comments

@MBrandt-NASA
Copy link

Here is what I see in SourceTree when I attempt to switch from Master to Develop (at this time there are tons of new unstaged changes in my working dir., if that matters). This is on Windows 10 using System Git version 2.10.1, after having followed all instructions on your unity-hooks repo for Windows:

=========================================

git -c diff.mnemonicprefix=false -c core.quotepath=false checkout develop
Your branch is up-to-date with 'origin/develop'.

Switched to branch 'develop'

  • Post-checkout hooks

    • Remove empty asset directories. x FAIL
      %1 is not a valid Win32 application

      Traceback (most recent call last):
      File "C:\Users\mbrandt\AppData\Local\Programs\Python\Python35-32\lib\site-packages\envoy\core.py", line 214, in run
      out, err = cmd.run(data, timeout, kill_timeout, env, cwd)
      File "C:\Users\mbrandt\AppData\Local\Programs\Python\Python35-32\lib\site-packages\envoy\core.py", line 93, in run
      raise self.exc
      File "C:\Users\mbrandt\AppData\Local\Programs\Python\Python35-32\lib\site-packages\envoy\core.py", line 75, in target
      cwd=cwd,
      File "C:\Users\mbrandt\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in init
      restore_signals, start_new_session)
      File "C:\Users\mbrandt\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
      startupinfo)
      OSError: [WinError 193] %1 is not a valid Win32 application

@Lattyware
Copy link
Member

Yeah, git hooks on Windows are a bit fun. We delegate to each subhook in the script, and while this works fine on Linux, the half-Linux environment git on Windows runs in chokes on it. The best solution is probably to throw out the bash stuff and subprocesses, use Python for the hooks (which should be cross platform). Some of the hooks are easier to implement as bash scripts, but it's probably not worth the pain.

Until then, we have some hacks in place to try and make this stuff work, where we parse out the hashbang line and try to run the right thing, which apparently is not working.

If you are on Windows 10 - the best solution would probably be to use git with the new Linux subsystem for Windows, but I doubt SourceTree can hook into that.

I'll take a look at pushing this to pure-python when I get the chance.

@MBrandt-NASA
Copy link
Author

MBrandt-NASA commented Dec 1, 2016 via email

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