Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame^] | 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) |