Skip to content

Commit 57ac5ba

Browse files
jcjfguenhter
authored andcommitted
Add HOME environment variable to git status call
Allows git status take the global core.excludesFile into account. Otherwise, the reported number of untracked files is incorrect.
1 parent 5da0a40 commit 57ac5ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitstatus.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# change those symbols to whatever you prefer
1414
symbols = {'ahead of': '↑·', 'behind': '↓·', 'prehash': ':'}
1515

16+
import os
1617
import sys
1718
import re
1819
from subprocess import Popen, PIPE
@@ -73,7 +74,8 @@ def get_stash():
7374

7475
# `git status --porcelain --branch` can collect all information
7576
# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
76-
po = Popen(['git', 'status', '--porcelain', '--branch'], env={'LC_ALL': 'C'}, stdout=PIPE, stderr=PIPE)
77+
po = Popen(['git', 'status', '--porcelain', '--branch'],
78+
env={'HOME': os.environ['HOME'], 'LC_ALL': 'C'}, stdout=PIPE, stderr=PIPE)
7779
stdout, stderr = po.communicate()
7880
if po.returncode != 0:
7981
sys.exit(0) # Not a git repository

0 commit comments

Comments
 (0)