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



commit a801a81ead5ce47a8ad4d10ff02b393ae3598a71
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.
    
    [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]