Skip to content

Commit e9037e7

Browse files
committed
mdist: don't fail on readonly source trees
In commit c9aa4af we added a refresh call to git to catch cases where checking for uncommitted changes would misfire. Unfortunately, that refresh performs a write operation, which in turn misfires on readonly media. We don't actually care about the return value of the refresh, since its purpose is solely to make the next command more accurate -- so ignore it. Fixes: c9aa4af Fixes: #13461
1 parent 86d1426 commit e9037e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mesonbuild/mdist.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ def git_root(self, dir_: str) -> Path:
141141

142142
def have_dirty_index(self) -> bool:
143143
'''Check whether there are uncommitted changes in git'''
144-
subprocess.check_call(['git', '-C', self.src_root, 'update-index', '-q', '--refresh'])
144+
# Optimistically call update-index, and disregard its return value. It could be read-only,
145+
# and only the output of diff-index matters.
146+
subprocess.call(['git', '-C', self.src_root, 'update-index', '-q', '--refresh'])
145147
ret = subprocess.call(['git', '-C', self.src_root, 'diff-index', '--quiet', 'HEAD'])
146148
return ret == 1
147149

0 commit comments

Comments
 (0)