Skip to content

Version tags don't get sorted topologically? #1080

@dpad

Description

@dpad

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Sorry if this is just a mistake, I'm not sure if I'm just misunderstanding things or if there is some weird behaviour with the "topo_order" option...

Basically, I have 3 commits tagged with version numbers like "v0.1.0", "v0.9.0", "v0.10.0" respectively. Topologically, the latest version (on the HEAD commit) is v0.10.0. However, running git-cliff --topo-order --latest will print out the "v0.9.0" changelog, and git-cliff --topo-order --unreleased will print out the "v0.10.0" changelog. Removing the --topo-order argument produces the expected result.

Steps To Reproduce

  1. git init
  2. git commit --allow-empty -m "feat: new"
  3. git commit --allow-empty -m "fix: whatever"
  4. git commit --allow-empty -m "doc: stuff"
  5. git tag v0.1.0 HEAD~2
  6. git tag v0.9.0 HEAD~
  7. git tag v0.10.0
$ git log --pretty=oneline
871adbf82b0dba2a4719fff11793387934a3cc11 (HEAD -> master, tag: v0.10.0) doc: stuff
b2c33a4df36176363f8a77421c917f212bfdcf98 (tag: v0.9.0) fix: whatever
457b3c4e0fadb9c8801e44d16d860054d9331609 (tag: v0.1.0) feat: new
$ git tag -l
v0.1.0
v0.10.0
v0.9.0
$ git cliff --topo-order --latest 
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
# Changelog

All notable changes to this project will be documented in this file.

<!-- generated by git-cliff -->
$ git cliff --topo-order --unreleased
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
# Changelog

All notable changes to this project will be documented in this file.

## [0.10.0] - 2025-03-06

### 📚 Documentation

- Stuff

<!-- generated by git-cliff -->

Generating the full changelog seems to have the tags in the correct order:

$ git cliff --topo-order
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
# Changelog

All notable changes to this project will be documented in this file.

## [0.10.0] - 2025-03-06

### 📚 Documentation

- Stuff

## [0.9.0] - 2025-03-06

### 🐛 Bug Fixes

- Whatever

## [0.1.0] - 2025-03-06

### 🚀 Features

- New

<!-- generated by git-cliff -->

Expected behavior

$ git cliff --latest 
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
# Changelog

All notable changes to this project will be documented in this file.

## [0.10.0] - 2025-03-06

### 📚 Documentation

- Stuff

<!-- generated by git-cliff -->
$ git cliff --unreleased
 WARN  git_cliff > "cliff.toml" is not found, using the default configuration.
# Changelog

All notable changes to this project will be documented in this file.

<!-- generated by git-cliff -->

Screenshots / Logs

No response

Software information

  • Operating system: Linux
  • Rust version:
  • Project version: 2.8.0

Additional context

Based on the behaviour above, it seems to me like the tags don't actually get sorted topologically when using --topo-order.

If you change the last tag from v0.10.0 to v0.9.1 instead, you get the same results both with and without --topo-order. So, I suspect there's some issue when the v0.10.0 tag gets sorted alphabetically before the v0.9.0 tag. (In other words, it looks like --topo-order is actually doing an alphabetical order, not a topological one??)

Am I just misunderstanding the purpose of --topo-order or --latest/--unreleased, or is there something weird going on here?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions