From: Junio C Hamano Date: Tue, 19 Jun 2012 22:19:51 +0000 (-0700) Subject: Meta/CheckPush: minor versions could have more than one digit X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ac7d225051008f5fc2d13cbd0c3d36a5b6122b;p=thirdparty%2Fgit.git Meta/CheckPush: minor versions could have more than one digit Add compare_dotted_version helper and use it Signed-off-by: Junio C Hamano --- diff --git a/CheckPush b/CheckPush index 7ce0d9a411..fcdc059b78 100755 --- a/CheckPush +++ b/CheckPush @@ -4,7 +4,33 @@ for range in $( prev_branch= { git for-each-ref --format='%(refname)' refs/heads/maint-* | - sed -e 's|^refs/heads/||' + perl -e ' + sub compare_dotted_version { + my (@ours) = split(/\./, $_[0]); + my (@theirs) = split(/\./, $_[1]); + my ($i, $diff); + + for ($i = 0; $i < @ours && $i < @theirs; $i++) { + $diff = $ours[$i] - $theirs[$i]; + return $diff if ($diff); + } + return 1 if ($i < @ours); + return -1 if ($i < @theirs); + return 0; + } + my @maint = (); + while () { + next unless s|^refs/heads/||; + chomp; + my ($v) = ($_ =~ /^maint-(.*)$/); + push @maint, [$v, $_]; + } + for (map { $_->[1] } + sort { compare_dotted_version($a->[0], $b->[0]) } + @maint) { + print "$_\n"; + } + ' cat <<-EOF maint master