mdist: don't fail on readonly source trees

In commit c9aa4aff66 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: c9aa4aff66
Fixes: #13461
pull/13462/head
Eli Schwartz 4 months ago
parent 86d142666a
commit e9037e7b9f
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 4
      mesonbuild/mdist.py

@ -141,7 +141,9 @@ class GitDist(Dist):
def have_dirty_index(self) -> bool:
'''Check whether there are uncommitted changes in git'''
subprocess.check_call(['git', '-C', self.src_root, 'update-index', '-q', '--refresh'])
# Optimistically call update-index, and disregard its return value. It could be read-only,
# and only the output of diff-index matters.
subprocess.call(['git', '-C', self.src_root, 'update-index', '-q', '--refresh'])
ret = subprocess.call(['git', '-C', self.src_root, 'diff-index', '--quiet', 'HEAD'])
return ret == 1

Loading…
Cancel
Save