+ my $version = shift // 'HEAD';
+
+ #
+ # v => {
+ # release => 4.92-RC4 | 4.92-27-gabcdef
+ # target_release|last_tag => 4.92 | 4.92
+ #
+ # major => 4
+ # minor => 92
+ # security =>
+ # fixes =>
+ #
+ # rc|quick => RC4 | 27-gabcdef
+ # }
+
+ #
+ # v => {
+ # release => 4.92-RC4 | 4.92-27-gabcdef-dirty
+ # target_release|last_tag => 4.92 | 4.92
+ #
+ # major => 4
+ # minor => 92
+ # security =>
+ # fixes =>
+ #
+ # rc|quick => RC4 | 27-gabcdef-dirty
+ # }
+
+ if ($context->{quick}) {
+ # Try to find suitable version description
+ chomp(my $describe = do { # we wrap it into a open() to avoid hassle with
+ open(my $fh, '-|', # strange version descriptions
+ 'git', describe => $version) or die;
+ <$fh>
+ } // exit 1);
+ $describe =~ /$quick_version_pattern/;
+
+ %{$context->{v}} = %+;
+ ($context->{commit}) = $version // ($context->{v}{quick} =~ /g([[:xdigit:]]+)/);
+ }
+ else {
+ croak "The given version number does not look right - $version"
+ if not $version =~ /$version_pattern/;
+ %{$context->{v}} = %+;