File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
gitoxide-core/src/repository Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,26 @@ pub fn list(repo: gix::Repository, out: &mut dyn std::io::Write) -> anyhow::Resu
5
5
let tag = reference. peel_to_tag ( ) ;
6
6
let tag_ref = tag. as_ref ( ) . map ( gix:: Tag :: decode) ;
7
7
8
- let name = match tag_ref {
9
- Ok ( Ok ( tag) ) => tag. name . to_string ( ) ,
10
- _ => reference. name ( ) . shorten ( ) . to_string ( ) ,
11
- } ;
8
+ // `name` is the name of the file in `refs/tags/`. This applies to both lightweight as well
9
+ // as annotated tags.
10
+ let name = reference. name ( ) . shorten ( ) ;
12
11
13
- writeln ! ( out, "{name}" ) ?;
12
+ match tag_ref {
13
+ Ok ( Ok ( tag_ref) ) => {
14
+ // `tag_name` is the name provided by the user via `git tag -a/-s/-u`. It is only
15
+ // present for annotated tags.
16
+ let tag_name = tag_ref. name ;
17
+
18
+ if name == tag_name {
19
+ writeln ! ( out, "{name} *" ) ?;
20
+ } else {
21
+ writeln ! ( out, "{name} [tag name: {}]" , tag_ref. name) ?;
22
+ }
23
+ }
24
+ _ => {
25
+ writeln ! ( out, "{name}" ) ?;
26
+ }
27
+ }
14
28
}
15
29
16
30
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments