Skip to content

Instantly share code, notes, and snippets.

@ivanpu
Last active May 31, 2024 20:04
Show Gist options
  • Save ivanpu/a9b02721163e10f21d914c8ae42e598d to your computer and use it in GitHub Desktop.
Save ivanpu/a9b02721163e10f21d914c8ae42e598d to your computer and use it in GitHub Desktop.
Rewrite of https://gist.github.com/gcollic/f6f093ec3805979669d0bf744e22c72a in Python, because I've needed this in my employer-provided Windows machine.
@echo off
python %~dp0git_for_intellij.py %*
#!/usr/bin/python
import re
import shlex
from subprocess import run
import sys
cmd = " ".join(shlex.quote(arg) for arg in sys.argv[1:])
regex = re.compile(r"(^|log.showSignature=false )(add|rm|mv) ")
if regex.search(cmd):
print('Stopping IntelliJ from being a not well-behaved git client. See IDEA-194592, IDEA-63391, IDEA-176961, ...', file=sys.stderr)
sys.exit(1)
sys.exit(run(["git", *sys.argv[1:]]).returncode)
@ivanpu
Copy link
Author

ivanpu commented Mar 31, 2021

@gcollic thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment