[gnome-photos/wip/rishi/meson-git-redundant-if] build: Remove redundant if branch



commit d8d9df18bee45fbbb1879263ddbe4e11df1cbaf2
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Sep 25 07:51:32 2018 +0200

    build: Remove redundant if branch
    
    Meson's 'find_program' function [1] aborts the build by default if the
    program can't be found, unless the keyword argument 'required' is set
    to 'false'. Therefore, there's no need to check the '.found()' on the
    returned object before proceeding.
    
    Fallout from cc5584327aacd6590ff69eeb5a130c41843ce3c8
    
    [1] http://mesonbuild.com/Reference-manual.html#find_program
    
    https://gitlab.gnome.org/GNOME/gnome-photos/merge_requests/58

 meson.build | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index 77f0410f..80892311 100644
--- a/meson.build
+++ b/meson.build
@@ -38,11 +38,9 @@ config_h.set_quoted('PACKAGE_URL', 'https://wiki.gnome.org/Apps/Photos')
 config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
 
 git = find_program('git')
-if git.found()
-  res = run_command(git, '-C', source_root, 'describe')
-  if res.returncode() == 0
-    config_h.set_quoted('PACKAGE_COMMIT_ID', res.stdout().strip())
-  endif
+res = run_command(git, '-C', source_root, 'describe')
+if res.returncode() == 0
+  config_h.set_quoted('PACKAGE_COMMIT_ID', res.stdout().strip())
 endif
 
 config_h.set_quoted('G_LOG_DOMAIN', meson.project_name())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]