From 3fbd6e8d6239ab11a23da374c7e8eeab8c036920 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 11 Sep 2015 10:52:49 +0100 Subject: [PATCH] cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch This moves it outside any prevailing set -x and reduces the amount of noise in various logs. Signed-off-by: Ian Campbell Acked-by: Ian Jackson --- cri-common | 16 +--------------- cri-getprevxenbranch | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) create mode 100755 cri-getprevxenbranch diff --git a/cri-common b/cri-common index 94696ab..2669485 100644 --- a/cri-common +++ b/cri-common @@ -61,21 +61,7 @@ repo_tree_rev_fetch_git () { } select_prevxenbranch () { - local b - local p - for b in $(./mg-list-all-branches) ; do # already sorted by version - case "$b" in - xen*) - if [ "x$b" = "x$xenbranch" ] ; then - break - else - p=$b - fi - ;; - *) ;; - esac - done - prevxenbranch=$p + prevxenbranch=`./cri-getprevxenbranch $xenbranch` } select_xenbranch () { diff --git a/cri-getprevxenbranch b/cri-getprevxenbranch new file mode 100755 index 0000000..308b0c7 --- /dev/null +++ b/cri-getprevxenbranch @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e + +xenbranch=$1 +p= + +for b in $(./mg-list-all-branches) ; do # already sorted by version + case "$b" in + xen*) + if [ "x$b" = "x$xenbranch" ] ; then + break + else + p=$b + fi + ;; + *) ;; + esac +done + +echo $p -- 2.39.5