Repository: pre-commit/pre-commit

Issue:
Not working from SmartGit
I know that this issue may not be caused by `pre-commit` directly, but figured out you guys could help me. Trying to commit directly from `SmartGit` prints this:

```
~/Development/ProjectName> git add --force -- Libraries/IOUtilities/NSString+IOUtilities.m
~/Development/ProjectName> git commit --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn/T/smartgit-2497340677383657620tmp/commit-4165014595931887528.tmp -o -- Libraries/IOUtilities/NSString+IOUtilities.m
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
An unexpected error has occurred: CalledProcessError: Command: ('/Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors: 
    /Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git-sh-setup: line 46: /usr/local/git/libexec/git-core/git-sh-i18n: No such file or directory
    
Check the log at /Users/revolt/.cache/pre-commit/pre-commit.log
```

and `cat /Users/revolt/.cache/pre-commit/pre-commit.log`:

```
An unexpected error has occurred: CalledProcessError: Command: ('/Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors: 
    /Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git-sh-setup: line 46: /usr/local/git/libexec/git-core/git-sh-i18n: No such file or directory
    

Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/error_handler.py", line 47, in error_handler
    yield
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/main.py", line 259, in main
    return run(runner, args)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/commands/run.py", line 244, in run
    for _, hook in repo.hooks:
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 173, in hooks
    if hook['id'] not in self.manifest_hooks:
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 167, in manifest_hooks
    manifest_path = os.path.join(self._repo_path, C.MANIFEST_FILE)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/cached_property.py", line 26, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 155, in _repo_path
    self.repo_config['repo'], self.repo_config['sha'],
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/store.py", line 154, in clone
    return self._new_repo(repo, ref, clone_strategy)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/store.py", line 130, in _new_repo
    make_strategy(directory)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/store.py", line 151, in clone_strategy
    env=no_git_env(),
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/util.py", line 187, in cmd_output
    returncode, cmd, retcode, output=(stdout, stderr),
pre_commit.util.CalledProcessError: Command: ('/Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
Return code: 1
Expected return code: 0
Output: (none)
Errors: 
    /Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git-sh-setup: line 46: /usr/local/git/libexec/git-core/git-sh-i18n: No such file or directory
```



Discussion:
I've seen this error before from a poorly compiled git -- from what I can tell there's two different `git` installations involved here, one in `/usr/local` and the other in `/Applications/SmartGit.app/Contents/Resources`.  From what I remember, this is due to a version mismatch between the two?  Let me see if I can track down where I hit the same thing


A few other things that seem to hit similar problems -- maybe a fix for `SmartGit` is needed?

- https://github.com/ForkIssues/Tracker/issues/67
- https://github.com/frej/fast-export/pull/73
- https://www.spinics.net/lists/git/msg291626.html (this is the most identical to this issue)
`/usr/local/git` doesn't exist :-?
you know what, I bet this is a bad interaction between SmartGit and brew

brew installs a symlink to `/usr/local/bin/git`, which smartgit is (maybe?) interpreting as having a prefix of `/usr/local` and then expecting the rest of the git toolset to live there? and maybe it should be using `git --exec-path` to call the rest of the executables -- hard to know without seeing the source.
This to me really looks like a problem with the setup of SmartGit's bundling of `git`.

I'd try and make a small reproducible testcase and report it to their issue tracker (?) -- it seems to be closed source.
I've sent them a support email, please leave this open and I'll update it with more info (hopefully a fixing pre-release build of their app).
Sounds great, will do :)
I have confirmed that this is indeed the problem:

```
asottile@Macbook-Pro:/private/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/AppTranslocation/E271C7D6-EE94-4454-BE6B-3312DF6FC51D/d/SmartGit.app$ ./Contents/Resources/git/bin/git --exec-path
/usr/local/git/libexec/git-core
```

It should be reporting (in my case) `/private/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/AppTranslocation/E271C7D6-EE94-4454-BE6B-3312DF6FC51D/d/SmartGit.app/Contents/Resources/git`
> It should be reporting (in my case) /private/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/AppTranslocation/E271C7D6-EE94-4454-BE6B-3312DF6FC51D/d/SmartGit.app$ ./Contents/Resources/git

Seems like your post is truncated?
@mstrap edited! Posted in a rush :D
For me, `git --exec-path` from `SmartGit`'s folder prints `/usr/local/Cellar/git/2.15.0/libexec/git-core`
That's correct for brew-installed `git`, but when `SmartGit` makes commits it uses its vendored `git` binary which is misconfigured.
For SmartGit, we just take a clean OSX Git bundle and repack it, so I guess when replacing SmartGit's bundled Git with your system Git (by copying over to the SmartGit folder), you will still see the unexpected `--exec-path`. I would guess this is because Git executables are searched on the `PATH`. Setting `GIT_EXEC_PATH` for SmartGit will probably help.
I don't think any copying of system git is happening here, git's exec prefix is set at *compile time*, relocating the executable will make that compiled-in value incorrect.  From some inspection, the build process for SmartGit builds git with `--prefix=/usr/local/git` -- I'm not sure git has a good story for moving the binaries to a different location than they were configured with -- does exporting `GIT_EXEC_PATH` from SmartGit's side work?  If so that's probably a good compromise.
So should `export GIT_EXEC_PATH=/Applications/SmartGit.app/Contents/Resources/git/bin` in my `.zshrc` work?
That'll likely break the git at `/usr/local/bin/git` (the one that's actually on your shell's path), `SmartGit` should be exporting that when it runs *it's* git which has a baked-in exec prefix at a different path.

Alternatively, `SmartGit` should either:
- pick a well-known location and build + install git in that directory -- though I know nothing about how packaging on osx works.
- depend on an externally installed git (either through `brew` / xcode binutils) -- these are likely to be compiled with the correct prefix
Well, even if it breaks the default `git`, it doesn't work in SmartGit. Nor does it work if I set `/usr/local/Cellar/git/2.15.0/libexec/git-core` as the `git` executable inside SmartGit's preferences.
What if you set `/usr/local/bin/git` as the git executable, does the failure output change?
output:

```
Commit: commit failed (return code 1)
	~/Development/ProjectName> git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn/T/smartgit-6449423194060998851tmp/commit-7252607506634785770.tmp
	[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
	[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
	[INFO] Once installed this environment will be reused.
	[INFO] This may take a few minutes...
	An unexpected error has occurred: CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
	Return code: 1
	Expected return code: 0
	Output: 
	    Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
	    Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
	    
	Errors: 
	    Traceback (most recent call last):
	      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
	        "__main__", mod_spec)
	      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
	        exec(code, run_globals)
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
	        main()
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
	        symlink=options.symlink)
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
	        site_packages=site_packages, clear=clear, symlink=symlink))
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
	        copy_required_modules(home_dir, symlink)
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
	        copyfile(filename, dst_filename, symlink)
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
	        os.makedirs(os.path.dirname(dest))
	      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
	        mkdir(name, mode)
	    FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default/lib/python3.6/lib-dynload'
```

log:

```
An unexpected error has occurred: CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
Return code: 1
Expected return code: 0
Output: 
    Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
    Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
    
Errors: 
    Traceback (most recent call last):
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
        main()
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
        site_packages=site_packages, clear=clear, symlink=symlink))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
        copy_required_modules(home_dir, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
        copyfile(filename, dst_filename, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
        os.makedirs(os.path.dirname(dest))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
        mkdir(name, mode)
    FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default/lib/python3.6/lib-dynload'
    

Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/error_handler.py", line 47, in error_handler
    yield
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/main.py", line 259, in main
    return run(runner, args)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/commands/run.py", line 256, in run
    repo.require_installed()
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 202, in require_installed
    _install_all(self._venvs, self.repo_config['repo'], self.store)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 102, in _install_all
    language.install_environment(cmd_runner, version, deps)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/languages/python.py", line 126, in install_environment
    repo_cmd_runner.run(venv_cmd, cwd='/', env=venv_env)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/prefixed_command_runner.py", line 38, in run
    return cmd_output(*replaced_cmd, __popen=self.__popen, **kwargs)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/util.py", line 187, in cmd_output
    returncode, cmd, retcode, output=(stdout, stderr),
pre_commit.util.CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
Return code: 1
Expected return code: 0
Output: 
    Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
    Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
    
Errors: 
    Traceback (most recent call last):
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
        main()
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
        site_packages=site_packages, clear=clear, symlink=symlink))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
        copy_required_modules(home_dir, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
        copyfile(filename, dst_filename, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
        os.makedirs(os.path.dirname(dest))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
        mkdir(name, mode)
    FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repo1nqdu3cs/py_env-default/lib/python3.6/lib-dynload'
```
Ooh that looks like a different trace now so a proper workaround for the SmartGit issue -- let me see if I can reproduce the same thing.  Can you provide `brew list`? (assuming you're using pre-commit from brew)
Just to confirm, can you run `pre-commit clean` and try that again?  This error should be unreachable from what I understand (unless the commit was forcibly killed in some way)
`brew list`:

```
ack
apngasm
archey
asciinema
atari800
autoconf
automake
aws-elasticbeanstalk
base64
bash-completion
bdw-gc
boost
cairo
carthage
cask
chisel
cmake
colordiff
coreutils
csvtomd
ctls
curl
doxygen
emacs
exif
fdupes
ffmpeg
flake8
fontconfig
fpc
freetype
gd
gdbm
gdk-pixbuf
gettext
git
glew
glib
gmp
gobject-introspection
googler
graphite2
graphviz
grc
grep
harfbuzz
highlight
icu4c
imagemagick
intltool
ircii
jasper
jemalloc
jpeg
lame
libcroco
libexif
libffi
libmodplug
libogg
libpng
librsvg
libssh2
libtasn1
libtermkey
libtiff
libtool
libusb
libusb-compat
libuv
libvorbis
libvpx
libvterm
libxdg-basedir
libxml2
links
llvm
lua
lua51
lua@5.1
luajit
lynx
lzlib
m-cli
mackup
makedepend
mercurial
minizip
msgpack
nasm
ncdu
neovim
nettle
node
ode
openssl
openssl@1.1
p7zip
pango
pcre
pixman
pkg-config
popt
pre-commit
pstree
pv
python
python3
qt
qt5
readline
recode
redis
rename
sdl
sdl2
sdl2_image
sdl2_mixer
sdl2_net
sdl2_ttf
sdl_gfx
sdl_image
sdl_mixer
sdl_net
sdl_ttf
sha2
shared-mime-info
sqlcipher
sqlite
texi2html
tig
tree
unar
uncrustify
unibilium
unrar
vapor
w3m
webp
wget
widelands
x264
xctool
xvid
xz
yarn
yasm
youtube-dl
```

I already manually deleted the `~/.cache/pre-commit` folder.
ok I can reproduce that now too, I added some debugging information to `.git/hooks/pre-commit` to see what was happening:

```
echo "================="
set -x
: "USER=$USER"
: "PATH=$PATH"
set +x
echo "================="
```

...

```
~/workspace/pyexample2> git add --force -- WORKSHOP.md
~/workspace/pyexample2> git commit --file=/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/smartgit-5453585049771415215tmp/commit-1803978370861371285.tmp -o -- WORKSHOP.md
=================
+ : USER=asottile
+ : PATH=/Library/Developer/CommandLineTools/usr/libexec/git-core:/private/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/AppTranslocation/9148D7E1-4EDE-4A58-84F6-69E930D38B91/d/SmartGit.app/Contents/Resources:/usr/bin:/bin:/usr/sbin:/sbin
+ set +x
=================
```

Seems the `PATH` is incorrect, missing `/usr/local/bin`

when I *manually* add `/usr/local/bin` to the path `export PATH=/usr/local/bin:$PATH` it works as I expect -- wonder why SmartGit is removing `/usr/local/bin` (a standard entry in `PATH`)

The root of _that_ problem seems to be `virtualenv` misbehaves when `PATH` is limited:

```
$ PATH=/usr $(readlink -f ~/opt/venv/bin/python) -m virtualenv venv
...
  File "/Users/asottile/opt/venv/bin/../lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: '/Users/asottile/workspace/pyexample2/venv/lib/python3.6/config-3.6m-darwin'
```

In conclusion a fix from SmartGit probably involves:
- `export GIT_EXEC_PATH=path/to/their/bundled/git`
- `export PATH=path/to/their/bundled/git:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`
@mstrap, Is this something you could fix? It would help me immensely 😄 
I don't have enough understanding about `GIT_EXEC_PATH` yet. `PATH` is definitely a configuration problem on the system. Usually, if such errors occur, reason is that `/usr/local/bin` is added to the `PATH` in some `~/.profile` which will only be read by apps started from the terminal. For solutions see here: https://stackoverflow.com/a/3756686


Regarding `GIT_EXEC_PATH`, it's set by SmartGit on OSX when invoking "git", if it's not already defined. 
SmartGit will log details in `log.txt` if you set system property `log4j.q.exec=DEBUG`.

Can't you see that `GIT_EXEC_PATH` in your hook?

One more note: please move your `SmartGit.app` to the trash and extract freshly to `/Applications` to get rid of `/private/var/folders/7x/97jnmnt13sl46bx2mc9chzpm0000gn/T/AppTranslocation/9148D7E1-4EDE-4A58-84F6-69E930D38B91/d/SmartGit.app/Contents/Resources` for `PATH`s.
@mstrap `/usr/local/bin` should be part of the `PATH` independent of rcfiles:

```
$ env -i /bin/bash --noprofile --norc -c 'echo $PATH'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
```

It's part of the standard FHS hierarchy:

```
$ man hier | grep usr/local/bin -C1

       /usr/local/bin
              Binaries for programs local to the site.
```
SmartGit won't remove components from the `PATH`, so if the `PATH` is correct already, then there should be no problems. SmartGit will log all environment variables it has been started with to `log.txt`.
Having `/usr/local/bin/git` set as the `git` executable, this is the `log.txt`:

```
42735792 (2017-11-30 13:05:18,503) [main] INFO  q.swt.shellActivation  - Activation change from null to Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A
42735792 (2017-11-30 13:05:18,503) [main] INFO  smartgit.repository.backgroundScan  - Starting background refreshing.
42735895 (2017-11-30 13:05:18,606) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=412)
42736095 (2017-11-30 13:05:18,806) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=414)
42736199 (2017-11-30 13:05:18,910) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=414)
42736396 (2017-11-30 13:05:19,107) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=416)
42736500 (2017-11-30 13:05:19,211) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=416)
42736645 (2017-11-30 13:05:19,356) [main] INFO              q.action  - Performing 'commit, Commit…, Commit local changes.' menu item in Local from menu in window org.eclipse.swt.widgets.Shell@5F71C76A:Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}
42736696 (2017-11-30 13:05:19,407) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=418)
42736796 (2017-11-30 13:05:19,507) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=418)
42736996 (2017-11-30 13:05:19,707) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=420)
42737074 (2017-11-30 13:05:19,785) [main] INFO       smartgit.commit  - Commit message from pending commit
42737078 (2017-11-30 13:05:19,789) [main] INFO              q.dialog  - Showing dialog 6 (@D79FD49) '@730E92FF - Commit' (owner: @5F71C76A)
42737096 (2017-11-30 13:05:19,807) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=420)
42737118 (2017-11-30 13:05:19,829) [main] INFO  q.swt.shellActivation  - Activation change from Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A to Shell {}@D79FD49
42737118 (2017-11-30 13:05:19,829) [main] INFO  smartgit.repository.backgroundScan  - Stopping background refreshing.
42737297 (2017-11-30 13:05:20,008) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=422)
42737325 (2017-11-30 13:05:20,036) [main] INFO  q.swt.shellActivation  - Activation remains at Shell {}@D79FD49
42737401 (2017-11-30 13:05:20,112) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=422)
42737598 (2017-11-30 13:05:20,309) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=424)
42737694 (2017-11-30 13:05:20,405) [main] INFO              q.action  - Performing 'Commit' button in window @D79FD49 owner @5F71C76A
42737694 (2017-11-30 13:05:20,405) [main] INFO              q.dialog  - Closing dialog with option OK - 2 - 6 (@D79FD49) '@730E92FF - Commit' (owner: @5F71C76A)
42737694 (2017-11-30 13:05:20,405) [main] INFO              q.dialog  - Disposing dialog 6 (@D79FD49) '@730E92FF - Commit' (owner: @5F71C76A)
42737700 (2017-11-30 13:05:20,411) [main] INFO  q.swt.shellActivation  - Activation change from Shell {*Disposed*}@D79FD49 to Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A
42737700 (2017-11-30 13:05:20,411) [main] INFO  smartgit.repository.backgroundScan  - Starting background refreshing.
42737786 (2017-11-30 13:05:20,497) [main] INFO              q.dialog  - Showed dialog 6 (@D79FD49) '@730E92FF - Commit' (owner: @5F71C76A) (OK - 2)
42737867 (2017-11-30 13:05:20,578) [WorkerThread-1] INFO      smartgit.command  - Commit [/Users/revolt/Development/ProjectName] / (amend=false;sign-off=false;no-verify=false;pathsToInclude=[])
42737882 (2017-11-30 13:05:20,593) [WorkerThread-1] INFO                q.exec  - Executing #168 [/Users/revolt/Development/ProjectName] /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn/T/smartgit-5895723688202603195tmp/commit-7319034439059866461.tmp
42738477 (2017-11-30 13:05:21,188) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
42741589 (2017-11-30 13:05:24,300) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
42741589 (2017-11-30 13:05:24,300) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: [INFO] Once installed this environment will be reused.
42741589 (2017-11-30 13:05:24,300) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: [INFO] This may take a few minutes...
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: An unexpected error has occurred: CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repoxr32u7ic/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: Return code: 1
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: Expected return code: 0
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: Output: 
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: Errors: 
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     Traceback (most recent call last):
42741705 (2017-11-30 13:05:24,416) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         "__main__", mod_spec)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         exec(code, run_globals)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         main()
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         symlink=options.symlink)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         site_packages=site_packages, clear=clear, symlink=symlink))
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         copy_required_modules(home_dir, symlink)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         copyfile(filename, dst_filename, symlink)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         os.makedirs(os.path.dirname(dest))
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:       File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:         mkdir(name, mode)
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repoxr32u7ic/py_env-default/lib/python3.6/lib-dynload'
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr:     
42741706 (2017-11-30 13:05:24,417) [QThreadPoolThread-0 (stderr-#168 /usr/local/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn)] INFO  smartgit.command.logging  - stderr: Check the log at /Users/revolt/.cache/pre-commit/pre-commit.log
42741727 (2017-11-30 13:05:24,438) [WorkerThread-1] ERROR     smartgit.command  - commit failed (return code 1)
smartgit.kb: commit failed (return code 1)
	at smartgit.kg.a(SourceFile:62)
	at smartgit.tB.a(SourceFile:84)
	at smartgit.tB.a(SourceFile:74)
	at smartgit.tB.a(SourceFile:70)
	at smartgit.tB.a(SourceFile:66)
	at smartgit.tB.a(SourceFile:61)
	at smartgit.tB.a(SourceFile:53)
	at smartgit.tG.a(SourceFile:180)
	at smartgit.aJq.a(SourceFile:85)
	at smartgit.aGg.a(SourceFile:60)
	at smartgit.aGg.a(SourceFile:22)
	at smartgit.oZ.a(SourceFile:90)
	at smartgit.hi.run(SourceFile:37)
	at smartgit.qj.run(SourceFile:96)
	at smartgit.ade.run(SourceFile:53)
42741727 (2017-11-30 13:05:24,438) [WorkerThread-1] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=428)
42742024 (2017-11-30 13:05:24,735) [WorkerThread-1] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=430)
42742024 (2017-11-30 13:05:24,735) [WorkerThread-1] INFO  smartgit.command.refresh  - Post-command refresh for [/<empty>, /<infinity>, /.git<immediates>] for /Users/revolt/Development/ProjectName
42742025 (2017-11-30 13:05:24,736) [WorkerThread-1] INFO        smartgit.model  - Local refresh started for /Users/revolt/Development/ProjectName [/<infinity>]
42742102 (2017-11-30 13:05:24,813) [main] INFO  smartgit.model.tree-table-synchronizer  - Model '/Users/revolt/Development/ProjectName' synchronized with UI (1469 directories processed, timestamp=25)
42742104 (2017-11-30 13:05:24,815) [main] INFO          commit.notes  - root changed /Users/revolt/Development/ProjectName -> /Users/revolt/Development/ProjectName
42742377 (2017-11-30 13:05:25,088) [main] INFO  smartgit.model.tree-table-synchronizer  - Model '/Users/revolt/Development/ProjectName' synchronized with UI (1469 directories processed, timestamp=26)
42742449 (2017-11-30 13:05:25,160) [WorkerThread-1] INFO  smartgit.model.statistics  - Refresh finished for /Users/revolt/Development/ProjectName (13490 entries) in 342ms, additional 82ms post-processing
42742713 (2017-11-30 13:05:25,424) [QThreadPoolThread-4 (smartgit.bqX)] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=430)
42742725 (2017-11-30 13:05:25,436) [QThreadPoolThread-4 (smartgit.bqX)] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=432)
42742725 (2017-11-30 13:05:25,436) [QThreadPoolThread-4 (smartgit.bqX)] INFO  smartgit.repository.backgroundScan  - Running background refresh: []
42744087 (2017-11-30 13:05:26,798) [main] INFO  q.swt.shellActivation  - Activation change from Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A to null
```
Having `/Applications/SmartGit.app/Contents/Resources/git/bin/git` set as the `git` executable, this is the `log.txt`:

```
45652217 (2017-11-30 13:53:54,928) [main] INFO  q.swt.shellActivation  - Activation change from null to Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A
45652217 (2017-11-30 13:53:54,928) [main] INFO  smartgit.repository.backgroundScan  - Starting background refreshing.
45652319 (2017-11-30 13:53:55,030) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=526)
45652520 (2017-11-30 13:53:55,231) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=528)
45652522 (2017-11-30 13:53:55,233) [QThreadPoolThread-4 (Refresh-0)] INFO        smartgit.model  - Local refresh started for /Users/revolt/Development/ProjectName [/<empty>]
45652590 (2017-11-30 13:53:55,301) [main] INFO  smartgit.model.tree-table-synchronizer  - Model '/Users/revolt/Development/ProjectName' synchronized with UI (1469 directories processed, timestamp=30)
45652592 (2017-11-30 13:53:55,303) [main] INFO          commit.notes  - root changed /Users/revolt/Development/ProjectName -> /Users/revolt/Development/ProjectName
45652622 (2017-11-30 13:53:55,333) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=528)
45652642 (2017-11-30 13:53:55,353) [QThreadPoolThread-4 (Refresh-0)] INFO  smartgit.model.statistics  - Refresh finished for /Users/revolt/Development/ProjectName (13490 entries) in 56ms, additional 64ms post-processing
45652747 (2017-11-30 13:53:55,458) [main] INFO              q.action  - Performing 'commit, Commit…, Commit local changes.' menu item in Local from menu in window org.eclipse.swt.widgets.Shell@5F71C76A:Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}
45652819 (2017-11-30 13:53:55,530) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=530)
45652922 (2017-11-30 13:53:55,633) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=530)
45653119 (2017-11-30 13:53:55,830) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=532)
45653154 (2017-11-30 13:53:55,865) [main] INFO       smartgit.commit  - Commit message from pending commit
45653164 (2017-11-30 13:53:55,875) [main] INFO              q.dialog  - Showing dialog 11 (@62962670) '@120AA894 - Commit' (owner: @5F71C76A)
45653180 (2017-11-30 13:53:55,891) [QThreadPoolThread-6 (smartgit.add)] INFO  smartgit.branch.manager  - Pausing and resuming tracking state evaluation for refs/heads/master
45653196 (2017-11-30 13:53:55,907) [main] INFO  q.swt.shellActivation  - Activation change from Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A to Shell {}@62962670
45653196 (2017-11-30 13:53:55,907) [main] INFO  smartgit.repository.backgroundScan  - Stopping background refreshing.
45653222 (2017-11-30 13:53:55,933) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=532)
45653407 (2017-11-30 13:53:56,118) [main] INFO  q.swt.shellActivation  - Activation remains at Shell {}@62962670
45653420 (2017-11-30 13:53:56,131) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=534)
45653524 (2017-11-30 13:53:56,235) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=534)
45653721 (2017-11-30 13:53:56,432) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=536)
45653823 (2017-11-30 13:53:56,534) [Timer-0] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=536)
45654022 (2017-11-30 13:53:56,733) [Timer-0] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=538)
45654532 (2017-11-30 13:53:57,243) [main] INFO              q.action  - Performing 'Commit' button in window @62962670 owner @5F71C76A
45654532 (2017-11-30 13:53:57,243) [main] INFO              q.dialog  - Closing dialog with option OK - 2 - 11 (@62962670) '@120AA894 - Commit' (owner: @5F71C76A)
45654532 (2017-11-30 13:53:57,243) [main] INFO              q.dialog  - Disposing dialog 11 (@62962670) '@120AA894 - Commit' (owner: @5F71C76A)
45654540 (2017-11-30 13:53:57,251) [main] INFO  q.swt.shellActivation  - Activation change from Shell {*Disposed*}@62962670 to Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A
45654540 (2017-11-30 13:53:57,251) [main] INFO  smartgit.repository.backgroundScan  - Starting background refreshing.
45654627 (2017-11-30 13:53:57,338) [main] INFO              q.dialog  - Showed dialog 11 (@62962670) '@120AA894 - Commit' (owner: @5F71C76A) (OK - 2)
45654703 (2017-11-30 13:53:57,414) [WorkerThread-1] INFO      smartgit.command  - Commit [/Users/revolt/Development/ProjectName] / (amend=false;sign-off=false;no-verify=false;pathsToInclude=[])
45654705 (2017-11-30 13:53:57,416) [WorkerThread-1] INFO                q.exec  - Executing #182 [/Users/revolt/Development/ProjectName] /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/folders/yj/l8y5kytd4tggcv7grrnpznh80000gn/T/smartgit-5895723688202603195tmp/commit-8034070819797025749.tmp
45655276 (2017-11-30 13:53:57,987) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
45657067 (2017-11-30 13:53:59,778) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: An unexpected error has occurred: CalledProcessError: Command: ('/Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git', 'submodule', 'update', '--init', '--recursive')
45657067 (2017-11-30 13:53:59,778) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: Return code: 1
45657067 (2017-11-30 13:53:59,778) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: Expected return code: 0
45657067 (2017-11-30 13:53:59,778) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: Output: (none)
45657067 (2017-11-30 13:53:59,778) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: Errors: 
45657068 (2017-11-30 13:53:59,779) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr:     /Applications/SmartGit.app/Contents/Resources/git/libexec/git-core/git-sh-setup: line 46: /usr/local/git/libexec/git-core/git-sh-i18n: No such file or directory
45657068 (2017-11-30 13:53:59,779) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr:     
45657068 (2017-11-30 13:53:59,779) [QThreadPoolThread-0 (stderr-#182 /Applications/SmartGit.app/Contents/Resources/git/bin/git commit --cleanup=whitespace --file=/var/fo)] INFO  smartgit.command.logging  - stderr: Check the log at /Users/revolt/.cache/pre-commit/pre-commit.log
45657092 (2017-11-30 13:53:59,803) [WorkerThread-1] ERROR     smartgit.command  - commit failed (return code 1)
smartgit.kb: commit failed (return code 1)
	at smartgit.kg.a(SourceFile:62)
	at smartgit.tB.a(SourceFile:84)
	at smartgit.tB.a(SourceFile:74)
	at smartgit.tB.a(SourceFile:70)
	at smartgit.tB.a(SourceFile:66)
	at smartgit.tB.a(SourceFile:61)
	at smartgit.tB.a(SourceFile:53)
	at smartgit.tG.a(SourceFile:180)
	at smartgit.aJq.a(SourceFile:85)
	at smartgit.aGg.a(SourceFile:60)
	at smartgit.aGg.a(SourceFile:22)
	at smartgit.oZ.a(SourceFile:90)
	at smartgit.hi.run(SourceFile:37)
	at smartgit.qj.run(SourceFile:96)
	at smartgit.ade.run(SourceFile:53)
45657093 (2017-11-30 13:53:59,804) [WorkerThread-1] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=542)
45657176 (2017-11-30 13:53:59,887) [WorkerThread-1] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=544)
45657176 (2017-11-30 13:53:59,887) [WorkerThread-1] INFO  smartgit.command.refresh  - Post-command refresh for [/<empty>, /<infinity>, /.git<immediates>] for /Users/revolt/Development/ProjectName
45657178 (2017-11-30 13:53:59,889) [WorkerThread-1] INFO        smartgit.model  - Local refresh started for /Users/revolt/Development/ProjectName [/<infinity>]
45657277 (2017-11-30 13:53:59,988) [main] INFO  smartgit.model.tree-table-synchronizer  - Model '/Users/revolt/Development/ProjectName' synchronized with UI (1469 directories processed, timestamp=31)
45657279 (2017-11-30 13:53:59,990) [main] INFO          commit.notes  - root changed /Users/revolt/Development/ProjectName -> /Users/revolt/Development/ProjectName
45657542 (2017-11-30 13:54:00,253) [main] INFO  smartgit.model.tree-table-synchronizer  - Model '/Users/revolt/Development/ProjectName' synchronized with UI (1469 directories processed, timestamp=32)
45657603 (2017-11-30 13:54:00,314) [WorkerThread-1] INFO  smartgit.model.statistics  - Refresh finished for /Users/revolt/Development/ProjectName (13490 entries) in 348ms, additional 76ms post-processing
45658545 (2017-11-30 13:54:01,256) [QThreadPoolThread-4 (smartgit.bqX)] INFO       sc.file.monitor  - Collecting changes, pending trigger file count is 0 (latestSeq=544)
45658567 (2017-11-30 13:54:01,278) [QThreadPoolThread-4 (smartgit.bqX)] INFO       sc.file.monitor  - Collecting changes finished (latestSeq=546)
45658567 (2017-11-30 13:54:01,278) [QThreadPoolThread-4 (smartgit.bqX)] INFO  smartgit.repository.backgroundScan  - Running background refresh: []
45659460 (2017-11-30 13:54:02,171) [main] INFO  q.swt.shellActivation  - Activation change from Shell {ProjectName - [~/Development/ProjectName] - SmartGit 17.1.2}@5F71C76A to null
```
@mstrap on osx if an application is launched using the launcher, it does not have all of the standard paths (notably it is missing those in `/usr/local`)
@asottile did you try the `launchctl setenv` approach from the SO-posting?
I did not, personally I have no intention of using SmartGit or even macos
Shouldn't this work without `launchctl` configurations?

@mstrap, Do the log files help you? Would you want me to try other configurations and post the log files?
> Shouldn't this work without `launchctl` configurations?

I certainly think it should.  If `SmartGit` is a thin wrapper around `git`, it should probably be running `git` (a cli tool) in an environment that a cli tool would normally be run in (with `/usr/local/bin` on the `PATH`)
[SourceTree](https://www.sourcetreeapp.com) doesn't work either though:

```
An unexpected error has occurred: CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repodb6kxcqp/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
Return code: 1
Expected return code: 0
Output: 
    Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
    Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
    
Errors: 
    Traceback (most recent call last):
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
        main()
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
        site_packages=site_packages, clear=clear, symlink=symlink))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
        copy_required_modules(home_dir, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
        copyfile(filename, dst_filename, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
        os.makedirs(os.path.dirname(dest))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
        mkdir(name, mode)
    FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repodb6kxcqp/py_env-default/lib/python3.6/lib-dynload'
    

Traceback (most recent call last):
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/error_handler.py", line 47, in error_handler
    yield
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/main.py", line 259, in main
    return run(runner, args)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/commands/run.py", line 256, in run
    repo.require_installed()
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 202, in require_installed
    _install_all(self._venvs, self.repo_config['repo'], self.store)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/repository.py", line 102, in _install_all
    language.install_environment(cmd_runner, version, deps)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/languages/python.py", line 126, in install_environment
    repo_cmd_runner.run(venv_cmd, cwd='/', env=venv_env)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/prefixed_command_runner.py", line 38, in run
    return cmd_output(*replaced_cmd, __popen=self.__popen, **kwargs)
  File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/pre_commit/util.py", line 187, in cmd_output
    returncode, cmd, retcode, output=(stdout, stderr),
pre_commit.util.CalledProcessError: Command: ('/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6', '-m', 'virtualenv', '/Users/revolt/.cache/pre-commit/repodb6kxcqp/py_env-default', '-p', '/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6')
Return code: 1
Expected return code: 0
Output: 
    Already using interpreter /usr/local/Cellar/pre-commit/1.4.1/libexec/bin/python3.6
    Using real prefix '/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6'
    
Errors: 
    Traceback (most recent call last):
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 2328, in <module>
        main()
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 925, in create_environment
        site_packages=site_packages, clear=clear, symlink=symlink))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1132, in install_python
        copy_required_modules(home_dir, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 1063, in copy_required_modules
        copyfile(filename, dst_filename, symlink)
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/lib/python3.6/site-packages/virtualenv.py", line 343, in copyfile
        os.makedirs(os.path.dirname(dest))
      File "/usr/local/Cellar/pre-commit/1.4.1/libexec/bin/../lib/python3.6/os.py", line 220, in makedirs
        mkdir(name, mode)
    FileExistsError: [Errno 17] File exists: '/Users/revolt/.cache/pre-commit/repodb6kxcqp/py_env-default/lib/python3.6/lib-dynload'
```
They likely have the same exact bug -- it's an easy footgun when writing macos applications
Yep, [GitHub Desktop](https://desktop.github.com) works well:

```
Commit failed - exit code 1 received, with output: '[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Trim Trailing Whitespace.................................................Failed
hookid: trailing-whitespace

Files were modified by this hook. Additional output:

Fixing Libraries/IOUtilities/NSString+IOUtilities.m'
```
> I certainly think it should. If SmartGit is a thin wrapper around git, it should probably be running git (a cli tool) in an environment that a cli tool would normally be run in (with /usr/local/bin on the PATH)

Do you have a suggestion on how to do that, given that SmartGit itself is launched with different environment variables than command line Git?
At a minimum, I'd expect all of the various FHS bin dirs to be on the path -- that is, modify `PATH` when it is missing any of `/usr/local/bin`, `/usr/local/sbin`, `/usr/bin`, `/usr/sbin`, `/bin`, `/sbin`.
@revolter did you eventually get SmartGit running, using the various mentioned workarounds? If so, what did you finally do?
@mstrap, Sadly, no, if you have any ideas for me to try, that doesn't require complex system configuration changes (as not a lot of users would be able/willing to do), I'll gladly do it. For example, is my `.zshrc` took into consideration by SmartGit when opened normally (e.g. Launchpad)? I could try to temporarily remove it in case it causes problems.
@revolter unfortunately I'm a little bit lost about what your configuration currently looks like: which Git executable do you have configured in the Preferences now? Did you apply any configuration changes to SmartGit now?

When starting SmartGit from terminal, does it work? If not, please apply suggestions from @asottile:

    export PATH=path/to/their/bundled/git:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

and if this doesn't help, also:

    export GIT_EXEC_PATH=path/to/their/bundled/git

If that does not work, try to configure the system Git in the Preferences and start SmartGit from terminal (so all relevant binaries will be on the `PATH`).

Having `/Applications/SmartGit.app/Contents/Resources/git/bin/git` as the `Git Executable` and running `open /Applications/SmartGit.app`, works! Most probably because `/usr/local/bin` is already in the `PATH`.
For the `libexec-dynload` issue, I believe that to be a problem with how `brew` is set up -- I've opened an issue with some detailed analysis here: https://github.com/Homebrew/homebrew-core/issues/21386
`libexec-dynload` problem has been fixed in homebrew!
How does this influence my issue? As I don't have that much knowledge to understand all of this.
It should work now independent of `PATH` though the git exec prefix still needs to be correct
Going to close this, one of the core issues was solved via brew and the other via properly setting the `git` executable.

Thanks again for the issue!  Glad we could make the `brew` integration better as well :)
Thank you for the help!

Resolving patch:
diff --git a/pre_commit/git.py b/pre_commit/git.py
--- a/pre_commit/git.py
+++ b/pre_commit/git.py
@@ -29,7 +29,8 @@ def no_git_env():
     # GIT_INDEX_FILE: Causes 'error invalid object ...' during commit
     return {
         k: v for k, v in os.environ.items()
-        if not k.startswith('GIT_') or k in {'GIT_SSH', 'GIT_SSH_COMMAND'}
+        if not k.startswith('GIT_') or
+        k in {'GIT_EXEC_PATH', 'GIT_SSH', 'GIT_SSH_COMMAND'}
     }
 
 


Test patch: