File tree Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Expand file tree Collapse file tree 1 file changed +14
-17
lines changed Original file line number Diff line number Diff line change @@ -63,23 +63,20 @@ pub fn get_tags(repo_path: &RepoPath) -> Result<Tags> {
6363 . map ( Into :: into) ?;
6464 let platform = gix_repo. references ( ) ?;
6565 for mut reference in ( platform. tags ( ) ?) . flatten ( ) {
66- let commit = reference. peel_to_commit ( ) . ok ( ) ;
67- let tag = reference. peel_to_tag ( ) . ok ( ) ;
68-
69- if let Some ( commit) = commit {
70- let name = tag
71- . as_ref ( )
72- . and_then ( |tag| {
73- let tag_ref = tag. decode ( ) . ok ( ) ;
74- tag_ref. map ( |tag_ref| tag_ref. name . to_string ( ) )
75- } )
76- . unwrap_or_else ( || {
77- reference. name ( ) . shorten ( ) . to_string ( )
78- } ) ;
79- let annotation = tag. and_then ( |tag| {
80- let tag_ref = tag. decode ( ) . ok ( ) ;
81- tag_ref. map ( |tag_ref| tag_ref. message . to_string ( ) )
82- } ) ;
66+ let commit = reference. peel_to_commit ( ) ;
67+ let tag = reference. peel_to_tag ( ) ;
68+
69+ if let Ok ( commit) = commit {
70+ let tag_ref = tag. as_ref ( ) . map ( gix:: Tag :: decode) ;
71+
72+ let name = match tag_ref {
73+ Ok ( Ok ( tag) ) => tag. name . to_string ( ) ,
74+ _ => reference. name ( ) . shorten ( ) . to_string ( ) ,
75+ } ;
76+ let annotation = match tag_ref {
77+ Ok ( Ok ( tag) ) => Some ( tag. message . to_string ( ) ) ,
78+ _ => None ,
79+ } ;
8380
8481 adder ( commit. into ( ) , Tag { name, annotation } ) ;
8582 }
You can’t perform that action at this time.
0 commit comments