diff options
| author | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-22 11:56:55 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-24 02:23:51 -0400 |
| commit | 19d31addd57abe35e2cebb750c0adfb668f103e4 (patch) | |
| tree | 8c0b6d795eaab12906a810e67c42288d321c9510 | |
| parent | 6565f4c958eae053dd617895462977092034b4e4 (diff) | |
mdist: don't fail on readonly source trees
In commit c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2 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: c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2
Fixes: #13461
(cherry picked from commit e9037e7b9ff81febbcef860dbfa785464ba3b457)
| -rw-r--r-- | mesonbuild/mdist.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index e4606306b..c29020068 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -140,7 +140,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 |
