summaryrefslogtreecommitdiffstats
path: root/scripts/git
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/git')
-rwxr-xr-xscripts/git26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/git b/scripts/git
new file mode 100755
index 0000000000..644055e540
--- /dev/null
+++ b/scripts/git
@@ -0,0 +1,26 @@
1#!/usr/bin/env python3
2#
3# Wrapper around 'git' that doesn't think we are root
4
5import os
6import shutil
7import sys
8
9os.environ['PSEUDO_UNLOAD'] = '1'
10
11# calculate path to the real 'git'
12path = os.environ['PATH']
13# we need to remove our path but also any other copy of this script which
14# may be present, e.g. eSDK.
15replacements = [os.path.dirname(sys.argv[0])]
16for p in path.split(":"):
17 if p.endswith("/scripts"):
18 replacements.append(p)
19for r in replacements:
20 path = path.replace(r, '/ignoreme')
21real_git = shutil.which('git', path=path)
22
23if len(sys.argv) == 1:
24 os.execl(real_git, 'git')
25
26os.execv(real_git, sys.argv)