diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-22 11:56:55 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-22 13:30:57 -0400 |
commit | e9037e7b9ff81febbcef860dbfa785464ba3b457 (patch) | |
tree | 3cdc11932a2621c38ae49d06dc302c6baad6e798 | |
parent | 86d142666a4517c9c5694c87dc92589214be920f (diff) | |
download | meson-e9037e7b9ff81febbcef860dbfa785464ba3b457.zip meson-e9037e7b9ff81febbcef860dbfa785464ba3b457.tar.gz meson-e9037e7b9ff81febbcef860dbfa785464ba3b457.tar.bz2 |
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
-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 b1d8f67..0c82cd3 100644 --- a/mesonbuild/mdist.py +++ b/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 |