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 /unittests | |
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 'unittests')
-rw-r--r-- | unittests/allplatformstests.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py index 86ffa92..9c9f616 100644 --- a/unittests/allplatformstests.py +++ b/unittests/allplatformstests.py @@ -1494,7 +1494,8 @@ class AllPlatformTests(BasePlatformTests): subproject('tarballsub', required : false) subproject('samerepo', required : false) ''')) - with open(os.path.join(project_dir, 'distexe.c'), 'w', encoding='utf-8') as ofile: + distexe_c = os.path.join(project_dir, 'distexe.c') + with open(distexe_c, 'w', encoding='utf-8') as ofile: ofile.write(textwrap.dedent('''\ #include<stdio.h> @@ -1528,6 +1529,8 @@ class AllPlatformTests(BasePlatformTests): self.assertPathDoesNotExist(gz_checksumfile) self.assertPathDoesNotExist(zip_distfile) self.assertPathDoesNotExist(zip_checksumfile) + # update a source file timestamp; dist should succeed anyway + os.utime(distexe_c) self._run(self.meson_command + ['dist', '--formats', 'bztar'], workdir=self.builddir) self.assertPathExists(bz_distfile) |