summaryrefslogtreecommitdiffstats
path: root/scripts/git-intercept/git
blob: 8adf5c9ecb71735fc8cae4f020db3d03801aa539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python3
#
# Wrapper around 'git' that doesn't think we are root

import os
import shutil
import sys

os.environ['PSEUDO_UNLOAD'] = '1'

# calculate path to the real 'git'
path = os.environ['PATH']
path = path.replace(os.path.dirname(sys.argv[0]), '')
real_git = shutil.which('git', path=path)

if len(sys.argv) == 1:
    os.execl(real_git, 'git')

os.execv(real_git, sys.argv)