Skip to content

Commit 6c798df

Browse files
author
Stephan Dilly
committed
fix different way of internal git represenation of tags to work (closes #206)
1 parent e7d17b2 commit 6c798df

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
- tags not shown in commit details popup ([#193](https://github.com/extrawurst/gitui/issues/193))
2626
- min size for relative popups on small terminals ([#179](https://github.com/extrawurst/gitui/issues/179))
2727
- fix crash on resizing terminal to very small width ([#198](https://github.com/extrawurst/gitui/issues/198))
28+
- fix broken tags when using a different internal representation ([#206](https://github.com/extrawurst/gitui/issues/206))
2829

2930
## [0.8.1] - 2020-07-07
3031

asyncgit/src/sync/tags.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@ pub fn get_tags(repo_path: &str) -> Result<Tags> {
2323

2424
let repo = repo(repo_path)?;
2525

26+
//TODO: use tag_foreach once its released
27+
// see https://github.com/rust-lang/git2-rs/pull/595
2628
for name in repo.tag_names(None)?.iter() {
2729
if let Some(name) = name {
28-
let obj = repo.revparse_single(name)?;
30+
let reference = repo.find_reference(
31+
format!("refs/tags/{}", name).as_str(),
32+
)?;
33+
let reference = reference.resolve()?;
2934

30-
if let Some(tag) = obj.as_tag() {
35+
let commit_id = if let Ok(tag) = reference.peel_to_tag() {
36+
Some(tag.target_id())
37+
} else {
38+
reference.target()
39+
};
40+
41+
if let Some(commit_id) = commit_id {
3142
let tag_name = String::from(name);
32-
adder(CommitId::new(tag.target_id()), tag_name);
43+
adder(CommitId::new(commit_id), tag_name);
3344
}
3445
}
3546
}

0 commit comments

Comments
 (0)