mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
fix different way of internal git represenation of tags to work (closes #206)
This commit is contained in:
parent
e7d17b2cf1
commit
6c798df40a
2 changed files with 15 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- tags not shown in commit details popup ([#193](https://github.com/extrawurst/gitui/issues/193))
|
||||
- min size for relative popups on small terminals ([#179](https://github.com/extrawurst/gitui/issues/179))
|
||||
- fix crash on resizing terminal to very small width ([#198](https://github.com/extrawurst/gitui/issues/198))
|
||||
- fix broken tags when using a different internal representation ([#206](https://github.com/extrawurst/gitui/issues/206))
|
||||
|
||||
## [0.8.1] - 2020-07-07
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,24 @@ pub fn get_tags(repo_path: &str) -> Result<Tags> {
|
|||
|
||||
let repo = repo(repo_path)?;
|
||||
|
||||
//TODO: use tag_foreach once its released
|
||||
// see https://github.com/rust-lang/git2-rs/pull/595
|
||||
for name in repo.tag_names(None)?.iter() {
|
||||
if let Some(name) = name {
|
||||
let obj = repo.revparse_single(name)?;
|
||||
let reference = repo.find_reference(
|
||||
format!("refs/tags/{}", name).as_str(),
|
||||
)?;
|
||||
let reference = reference.resolve()?;
|
||||
|
||||
if let Some(tag) = obj.as_tag() {
|
||||
let commit_id = if let Ok(tag) = reference.peel_to_tag() {
|
||||
Some(tag.target_id())
|
||||
} else {
|
||||
reference.target()
|
||||
};
|
||||
|
||||
if let Some(commit_id) = commit_id {
|
||||
let tag_name = String::from(name);
|
||||
adder(CommitId::new(tag.target_id()), tag_name);
|
||||
adder(CommitId::new(commit_id), tag_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue