diff options
author | Benjamin Gilbert <bgilbert@backtick.net> | 2024-04-27 03:06:41 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-04-27 21:58:41 -0400 |
commit | c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2 (patch) | |
tree | 522b9693222249919ab945265556a1a02e0b7d91 /mesonbuild | |
parent | 2004b7c24dbc4a3ff3d333df9456e1e1223e9c8b (diff) | |
download | meson-c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2.zip meson-c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2.tar.gz meson-c9aa4aff66ebbbcd3eed3da8fbc3af0e0a8b90a2.tar.bz2 |
mdist: gracefully handle stale Git index
Running `touch` on a tracked file in Git, to update its timestamp, and
then running `meson dist` would cause dist to fail:
ERROR: Repository has uncommitted changes that will not be included in the dist tarball
Use --allow-dirty to ignore the warning and proceed anyway
Unlike `git status` and `git diff`, `git diff-index` doesn't refresh the
index before comparing, so stat changes are assumed to imply content
changes. Run `git update-index -q --refresh` first to refresh the index.
Fixes: #12985
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/mdist.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py index 1ae0f59..e460630 100644 --- a/mesonbuild/mdist.py +++ b/mesonbuild/mdist.py @@ -140,6 +140,7 @@ 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']) ret = subprocess.call(['git', '-C', self.src_root, 'diff-index', '--quiet', 'HEAD']) return ret == 1 |