File 0002-fix-gits-unexpected-status.patch of Package gitslave

Index: gits
===================================================================
--- gits.orig
+++ gits
@@ -923,12 +923,7 @@ sub releasecheck($@)
     }
 
     my ($premove);
-    while ($msg =~ s/(^[^\#].*\n)//)
-    {
-      $premove .= $1;
-    }
-
-    die "gits unexpected status output (missing branch): $msg" unless ($msg =~ s/^\# (?:On branch |(Not currently on any branch.))(.+)?\n//);
+    die "gits unexpected status output (missing branch): $msg" unless ($msg =~ s/^(?:# )?(?:On branch |Not currently on any branch.)(.+)?\n?//);
     my $localbranch = $2;
     if ($1 =~ /^Not/)
     {
@@ -2714,12 +2709,7 @@ elsif ($ARGV[0] eq 'status')
     $okcnt++;
 
     my ($premove);
-    while ($msg =~ s/(^[^\#].*\n)//)
-    {
-      $premove .= $1;
-    }
-
-    die "gits unexpected status output (missing branch): $msg" unless ($msg =~ s/^\# (?:On branch |Not currently on any branch.)(.+)?\n//);
+    die "gits unexpected status output (missing branch): $msg" unless ($msg =~ s/^(?:# )?(?:On branch |Not currently on any branch.)(.+)?\n?//);
     my $localbranch = $1 ? $1 : "(no branch)";
     $branch = $localbranch unless ($branch);
     unless ($branch eq $localbranch)
@@ -2870,12 +2860,7 @@ elsif ($ARGV[0] eq 'statuses')
       $okcnt++;
 
       my ($premove);
-      while ($msg =~ s/(^[^\#].*\n)//)
-      {
-	$premove .= $1;
-      }
-
-      unless ($msg =~ s/^\# (?:On branch |Not currently on any branch.)(.+)?\n//)
+      unless ($msg =~ s/^(?:# )?(?:On branch |Not currently on any branch.)(.+)?\n?//)
       {
 	# <TODO>some way for do_checkout to only operate on some slaves</TODO>
 	$msg .= do_checkout(2, @oldbranch);
openSUSE Build Service is sponsored by