- if path:
- fp = open(path)
- else:
- nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))
-
- # read only the first line from the pipe
- sha1_bytes = subprocess.Popen(
- ['git', '--git-dir', nmbhome, 'show-ref', '-s', 'config'],
- stdout=subprocess.PIPE).stdout.readline()
- sha1 = sha1_bytes.decode(encoding).rstrip()
-
- fp_byte_stream = subprocess.Popen(
- ['git', '--git-dir', nmbhome, 'cat-file', 'blob',
- sha1+':status-config.json'],
- stdout=subprocess.PIPE).stdout
- fp = codecs.getreader(encoding=encoding)(stream=fp_byte_stream)
-