diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/git-intercept/git | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/git-intercept/git b/scripts/git-intercept/git new file mode 100755 index 0000000000..8adf5c9ecb --- /dev/null +++ b/scripts/git-intercept/git | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | # | ||
| 3 | # Wrapper around 'git' that doesn't think we are root | ||
| 4 | |||
| 5 | import os | ||
| 6 | import shutil | ||
| 7 | import sys | ||
| 8 | |||
| 9 | os.environ['PSEUDO_UNLOAD'] = '1' | ||
| 10 | |||
| 11 | # calculate path to the real 'git' | ||
| 12 | path = os.environ['PATH'] | ||
| 13 | path = path.replace(os.path.dirname(sys.argv[0]), '') | ||
| 14 | real_git = shutil.which('git', path=path) | ||
| 15 | |||
| 16 | if len(sys.argv) == 1: | ||
| 17 | os.execl(real_git, 'git') | ||
| 18 | |||
| 19 | os.execv(real_git, sys.argv) | ||
