From ee205375a963f0d44c8728cf881169683c9b912d Mon Sep 17 00:00:00 2001
From: David Mitchell <davem@iabyn.com>
Date: Mon, 12 Dec 2011 12:42:46 +0000
Subject: fix make_patchnum.pl branch determination

A previous commit of mine, 9077509c9b9bc1871867a5fba4351b95c670298d,
tried to handle the case where the output of 'git branch' was

    * (no branch)
      blead

to stop it outputting  a 'Use of uninitialized value' warning.
However, my "fix" broke in the case where multiple branches are listed
with the current not the first:

      blead
    * tmp1
      tmp2

Hopefully this fixes it properly.
---
 make_patchnum.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'make_patchnum.pl')

diff --git a/make_patchnum.pl b/make_patchnum.pl
index fcbfc6c789..9d83dd59f8 100644
--- a/make_patchnum.pl
+++ b/make_patchnum.pl
@@ -133,7 +133,8 @@ if (my $patch_file= read_file(".patch")) {
 }
 elsif (-d "$srcdir/.git") {
     # git branch | awk 'BEGIN{ORS=""} /\*/ { print $2 }'
-    ($branch) = map { /\* ([^(]\S*)/ ? $1 : "" } backtick("git branch");
+    ($branch) = map { /\* ([^(]\S*)/ ? $1 : () } backtick("git branch");
+    $branch //= "";
     my ($remote,$merge);
     if (length $branch) {
         $merge= backtick("git config branch.$branch.merge");
-- 
cgit v1.2.1