aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-09-13 13:44:43 -0400
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-09-18 03:01:15 +0000
commit6fbf368fdebd7a9c24f8e52bbe69e1e4c25aaac7 (patch)
tree9e40ef668912e201bd18e52017ba17a06699d544
parentce347f2f8cfdf0999f37c5a48e6580dd597cb5bf (diff)
downloadmeson-6fbf368fdebd7a9c24f8e52bbe69e1e4c25aaac7.zip
meson-6fbf368fdebd7a9c24f8e52bbe69e1e4c25aaac7.tar.gz
meson-6fbf368fdebd7a9c24f8e52bbe69e1e4c25aaac7.tar.bz2
msubprojects: Avoid useless "no local changes to save" message
-rwxr-xr-xmesonbuild/msubprojects.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py
index 9ae0061..9523dd3 100755
--- a/mesonbuild/msubprojects.py
+++ b/mesonbuild/msubprojects.py
@@ -47,9 +47,13 @@ def git_output(cmd, workingdir):
return quiet_git(cmd, workingdir, check=True)[1]
def git_stash(workingdir):
- # Don't pipe stdout here because we want the user to see their changes have
- # been saved.
- verbose_git(['stash'], workingdir, check=True)
+ # That git command return 1 (failure) when there is something to stash.
+ # We don't want to stash when there is nothing to stash because that would
+ # print spurious "No local changes to save".
+ if not quiet_git(['diff', '--quiet', 'HEAD'], workingdir)[0]:
+ # Don't pipe stdout here because we want the user to see their changes have
+ # been saved.
+ verbose_git(['stash'], workingdir, check=True)
def git_show(repo_dir):
commit_message = git_output(['show', '--quiet', '--pretty=format:%h%n%d%n%s%n[%an]'], repo_dir)