Last active
May 31, 2024 20:04
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
python %~dp0git_for_intellij.py %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For information, a bracket is missing in the gist:
sys.exit(run(["git", *sys.argv[1:]]).returncode)
😉