make-version: Don't emit one common warning to stderr
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>
Thu, 25 Feb 2016 21:34:45 +0000 (21:34 +0000)
committerJoão Valverde <j@v6e.pt>
Mon, 29 Feb 2016 22:07:37 +0000 (22:07 +0000)
git rev-parse @{upstream} will (obviously) fail if there is no
upstream set for the current branch. This is fairly common and
not problematic. Don't emit an error message to stderr when it
fails.

Change-Id: I4989fb19b25fefff83335061151e360c78652e88
Reviewed-on: https://code.wireshark.org/review/14151
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
make-version.pl

index 76fbf2c4516d57f6ea8501cce06a28c480da9d26..880a77ce1d020e0611a102a11dd601a86aecf74d 100755 (executable)
@@ -59,6 +59,7 @@ use strict;
 
 use Time::Local;
 use File::Basename;
+use File::Spec;
 use POSIX qw(strftime);
 use Getopt::Long;
 use Pod::Usage;
@@ -124,6 +125,7 @@ sub read_repo_info {
        my $repo_version;
        my $do_hack = 1;
        my $info_source = "Unknown";
+       my $devnull = File::Spec->devnull();
 
        # Make sure git is available.
        if (!`$git_executable --version`) {
@@ -191,7 +193,7 @@ sub read_repo_info {
 
                        # This will break in some cases. Hopefully not during
                        # official package builds.
-                       chomp($line = qx{$git_executable --git-dir="$srcdir"/.git rev-parse --abbrev-ref --symbolic-full-name \@\{upstream\}});
+                       chomp($line = qx{$git_executable --git-dir="$srcdir"/.git rev-parse --abbrev-ref --symbolic-full-name \@\{upstream\} 2> $devnull});
                        if ($? == 0 && length($line) > 1) {
                                $repo_branch = basename($line);
                        }