Repository: orhun/git-cliff (rust)

Issue:
The `--current` option involves the release notes of other tags
**Describe the bug**

When the commit-graph is like the following, the `--current` option doesn't work correctly.

![image](https://user-images.githubusercontent.com/31987104/151713794-3f8bb081-6bae-4f6b-952c-77a82e749bb4.png)

The `tags` variable was like this.

![image](https://user-images.githubusercontent.com/31987104/151712780-56e4ed81-e4f5-4369-ba5e-979b714cbb3e.png)

However, the current code uses `current_tag_index - 1` for the previous tag.

https://github.com/orhun/git-cliff/blob/848d8a587efd5f611a98b647b954c06938fac24a/git-cliff/src/lib.rs#L169

I think we should find the nearest parent tag here.

**To Reproduce**

I attached my test scripts and the output.
Please save this script and run it.

<details>
<summary>test script</summary>

```bash
#!/bin/bash
set -e

# Set up repository
rm -rf /tmp/test
mkdir -p /tmp/test
cd /tmp/test
git init
git commit --allow-empty -m "Initial commit"

# Create tags
git commit --allow-empty -m "feat: v0.1.0"
git tag v0.1.0
sleep 1

git checkout v0.1.0
git commit --allow-empty -m "feat: v0.2.0"
git tag v0.2.0
sleep 1

git checkout v0.1.0
git commit --allow-empty -m "fix: v0.1.1"
git tag v0.1.1
sleep 1

git checkout v0.2.0
git commit --allow-empty -m "feat: v0.3.0"
git tag v0.3.0
sleep 1

# Show results
git checkout v0.1.0
echo "------"
echo "v0.1.0"
git-cliff --current
echo "------"

git checkout v0.1.1
echo "------"
echo "v0.1.1"
git-cliff --current
echo "------"

git checkout v0.2.0
echo "------"
echo "v0.2.0"
git-cliff --current
echo "------"

git checkout v0.3.0
echo "------"
echo "v0.3.0"
git-cliff --current
echo "------"
```

</details>

Without `sleep`, probably because the commit timestamp will be the same and it won't reproduce the problem.

<details>
<summary>output</summary>

```sh-session
$ ./test.sh
Initialized empty Git repository in /tmp/test/.git/
[main (root-commit) 228dbab] Initial commit
[main 7d5b9fb] feat: v0.1.0
Note: switching to 'v0.1.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 7d5b9fb feat: v0.1.0
[detached HEAD ee77516] feat: v0.2.0
Previous HEAD position was ee77516 feat: v0.2.0
HEAD is now at 7d5b9fb feat: v0.1.0
[detached HEAD 44cfc20] fix: v0.1.1
Previous HEAD position was 44cfc20 fix: v0.1.1
HEAD is now at ee77516 feat: v0.2.0
[detached HEAD 567de7b] feat: v0.3.0
Previous HEAD position was 567de7b feat: v0.3.0
HEAD is now at 7d5b9fb feat: v0.1.0
------
v0.1.0
 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.1.0] - 2022-01-30

### Features

- V0.1.0

<!-- generated by git-cliff -->
------
Previous HEAD position was 7d5b9fb feat: v0.1.0
HEAD is now at 44cfc20 fix: v0.1.1
------
v0.1.1
 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.1.1] - 2022-01-30

### Bug Fixes

- V0.1.1

<!-- generated by git-cliff -->
------
Previous HEAD position was 44cfc20 fix: v0.1.1
HEAD is now at ee77516 feat: v0.2.0
------
v0.2.0
 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.2.0] - 2022-01-30

### Features

- V0.2.0

<!-- generated by git-cliff -->
------
Previous HEAD position was ee77516 feat: v0.2.0
HEAD is now at 567de7b feat: v0.3.0
------
v0.3.0
 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.3.0] - 2022-01-30

### Features

- V0.3.0

## [0.2.0] - 2022-01-30

### Features

- V0.2.0

<!-- generated by git-cliff -->
------
```

</details>

`0.2.0` is included in `0.3.0`.

```text
## [0.3.0] - 2022-01-30

### Features

- V0.3.0

## [0.2.0] - 2022-01-30

### Features

- V0.2.0
```

**Expected behavior**

The output only includes the tag's changes.

In this case:

```text
## [0.3.0] - 2022-01-30

### Features

- V0.3.0
```


Pull request description:
feat(changelog, config)!: replace --topo-order by --date-order
## Description
<!--- Describe your changes in detail -->

Resolves #54

As explained in https://github.com/orhun/git-cliff/issues/54#issuecomment-1030661108, I replaced `--topo-order` by `--date-order`, which means the default value will be `date_order=false (topo_order=true)`.

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

> since topo-order is already default for git, maybe it should be default for git-cliff
in that case, --topo-order flag is unnecessary and should be renamed to --date-order

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

The test script in https://github.com/orhun/git-cliff/issues/54#issue-1118679329 worked correctly.

## Screenshots / Output (if appropriate):

<details>
<summary>output</summary>

```sh-session
$ ./test.sh
Initialized empty Git repository in /tmp/test/.git/
[main (root-commit) 02b906e] Initial commit
[main 5b8ba4b] feat: v0.1.0
Note: switching to 'v0.1.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 5b8ba4b feat: v0.1.0
[detached HEAD f7c021e] feat: v0.2.0
Previous HEAD position was f7c021e feat: v0.2.0
HEAD is now at 5b8ba4b feat: v0.1.0
[detached HEAD 3b5dfe3] fix: v0.1.1
Previous HEAD position was 3b5dfe3 fix: v0.1.1
HEAD is now at f7c021e feat: v0.2.0
[detached HEAD 0c8228c] feat: v0.3.0
Previous HEAD position was 0c8228c feat: v0.3.0
HEAD is now at 5b8ba4b feat: v0.1.0
------
v0.1.0
 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.1.0] - 2022-02-05

### Features

- V0.1.0

<!-- generated by git-cliff -->
------
Previous HEAD position was 5b8ba4b feat: v0.1.0
HEAD is now at 3b5dfe3 fix: v0.1.1
------
v0.1.1
 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.1.1] - 2022-02-05

### Bug Fixes

- V0.1.1

<!-- generated by git-cliff -->
------
Previous HEAD position was 3b5dfe3 fix: v0.1.1
HEAD is now at f7c021e feat: v0.2.0
------
v0.2.0
 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.2.0] - 2022-02-05

### Features

- V0.2.0

<!-- generated by git-cliff -->
------
Previous HEAD position was f7c021e feat: v0.2.0
HEAD is now at 0c8228c feat: v0.3.0
------
v0.3.0
 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.3.0] - 2022-02-05

### Features

- V0.3.0

<!-- generated by git-cliff -->
------
```

</details>

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (no code change)
- [ ] Refactor (refactoring production code)
- [ ] Other <!--- (provide information) -->

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My code follows the code style of this project.
- [x] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.


Patch:
diff --git a/.github/fixtures/cliff.toml b/.github/fixtures/cliff.toml
deleted file mode 100644
index 01adea2..00000000
--- a/.github/fixtures/cliff.toml
+++ /dev/null
@@ -1,59 +0,0 @@
-# configuration file for git-cliff (0.1.0)
-
-[changelog]
-# changelog header
-header = """
-# Changelog\n
-All notable changes to this project will be documented in this file.\n
-"""
-# template for the changelog body
-# https://tera.netlify.app/docs/#introduction
-body = """
-{% if version %}\
-    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
-{% else %}\
-    ## [unreleased]
-{% endif %}\
-{% for group, commits in commits | group_by(attribute="group") %}
-    ### {{ group | upper_first }}
-    {% for commit in commits %}
-        - {{ commit.message | upper_first }}\
-    {% endfor %}
-{% endfor %}\n
-"""
-# remove the leading and trailing whitespace from the template
-trim = true
-# changelog footer
-footer = """
-<!-- generated by git-cliff -->
-"""
-
-[git]
-# allow only conventional commits
-# https://www.conventionalcommits.org
-conventional_commits = true
-# regex for parsing and grouping commits
-commit_parsers = [
-    { message = "^feat", group = "Features"},
-    { message = "^fix", group = "Bug Fixes"},
-    { message = "^doc", group = "Documentation"},
-    { message = "^perf", group = "Performance"},
-    { message = "^refactor", group = "Refactor"},
-    { message = "^style", group = "Styling"},
-    { message = "^test", group = "Testing"},
-    { message = "^chore\\(release\\): prepare for", skip = true},
-    { message = "^chore", group = "Miscellaneous Tasks"},
-    { body = ".*security", group = "Security"},
-]
-# filter out the commits that are not matched by commit parsers
-filter_commits = false
-# glob pattern for matching git tags
-tag_pattern = "v[0-9]*"
-# regex for skipping tags
-skip_tags = "v0.1.0-beta.1"
-# regex for ignoring tags
-ignore_tags = "v.*-beta.*"
-# sort the tags topologically
-topo_order = false
-# sort the commits inside sections by oldest/newest order
-sort_commits = "oldest"
diff --git a/.github/fixtures/expected.md b/.github/fixtures/test-ignore-tags/expected.md
similarity index 89%
rename from .github/fixtures/expected.md
rename to .github/fixtures/test-ignore-tags/expected.md
index 2d96ad5..740a172 100644
--- a/.github/fixtures/expected.md
+++ b/.github/fixtures/test-ignore-tags/expected.md
@@ -4,14 +4,14 @@ All notable changes to this project will be documented in this file.
 
 ## [0.2.0] - 2021-01-23
 
-### Features
+### Feat
 
 - Add feature 2
 - Add feature 3
 
 ## [0.1.0] - 2021-01-23
 
-### Features
+### Feat
 
 - Add feature 1
 - Fix feature 1
diff --git a/README.md b/README.md
index 61822ad..e9a3e17 100644
--- a/README.md
+++ b/README.md
@@ -65,7 +65,7 @@
     - [tag_pattern](#tag_pattern)
     - [skip_tags](#skip_tags)
     - [ignore_tags](#ignore_tags)
-    - [topo_order](#topo_order)
+    - [date_order](#date_order)
     - [sort_commits](#sort_commits)
 - [Templating](#templating)
   - [Context](#context)
@@ -142,7 +142,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE]
 -l, --latest        Processes the commits starting from the latest tag
     --current       Processes the commits that belong to the current tag
 -u, --unreleased    Processes the commits that do not belong to a tag
-    --topo-order    Sorts the tags topologically
+    --date-order    Sorts the tags chronologically
 -h, --help          Prints help information
 -V, --version       Prints version information
 ```
@@ -245,11 +245,11 @@ git cliff --sort oldest
 git cliff --sort newest
 ```
 
-Sort the tags in topological order:
+Sort the tags in chronological order:
 
 ```sh
-# Process in topological order instead of chronological.
-git cliff --topo-order
+# Process in chronological order instead of topological.
+git cliff --date-order
 ```
 
 Save the changelog file to the specified file:
@@ -404,7 +404,7 @@ filter_commits = false
 tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 ignore_tags = ""
-topo_order = false
+date_order = false
 sort_commits = "oldest"
 link_parsers = [
     { pattern = "#(\\d+)", href = "https://github.com/orhun/git-cliff/issues/$1"},
@@ -500,11 +500,11 @@ A regex for ignore processing the matched tags.
 
 While `skip_tags` drop commits from the changelog, `ignore_tags` include ignored commits into the next tag.
 
-#### topo_order
+#### date_order
 
 If set to `true`, tags are processed in topological order instead of chronological.
 
-This can also be achieved by using the `--topo-order` command line flag.
+This can also be achieved by using the `--date-order` command line flag.
 
 #### sort_commits
 
diff --git a/config/cliff.toml b/config/cliff.toml
index d1bbc15..7a85fd1 100644
--- a/config/cliff.toml
+++ b/config/cliff.toml
@@ -54,7 +54,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/examples/detailed.toml b/examples/detailed.toml
index bb8616e..b6b57fd 100644
--- a/examples/detailed.toml
+++ b/examples/detailed.toml
@@ -60,7 +60,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/examples/keepachangelog.toml b/examples/keepachangelog.toml
index 2cc18a9..f6552c2 100644
--- a/examples/keepachangelog.toml
+++ b/examples/keepachangelog.toml
@@ -55,7 +55,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/examples/scoped.toml b/examples/scoped.toml
index 0a3d2d3..996b2f4 100644
--- a/examples/scoped.toml
+++ b/examples/scoped.toml
@@ -57,7 +57,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/examples/scopesorted.toml b/examples/scopesorted.toml
index 9ca9410..0f2f7de 100644
--- a/examples/scopesorted.toml
+++ b/examples/scopesorted.toml
@@ -69,7 +69,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/examples/unconventional.toml b/examples/unconventional.toml
index f829797..26cf18e 100644
--- a/examples/unconventional.toml
+++ b/examples/unconventional.toml
@@ -55,7 +55,7 @@ tag_pattern = "v[0-9]*"
 skip_tags = "v0.1.0-beta.1"
 # regex for ignoring tags
 ignore_tags = ""
-# sort the tags topologically
-topo_order = false
+# sort the tags chronologically
+date_order = false
 # sort the commits inside sections by oldest/newest order
 sort_commits = "oldest"
diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config.rs
index cc6423b..fa55859 100644
--- a/git-cliff-core/src/config.rs
+++ b/git-cliff-core/src/config.rs
@@ -47,8 +47,8 @@ pub struct GitConfig {
 	#[serde(with = "serde_regex", default)]
 	/// Regex to ignore matched tags.
 	pub ignore_tags:           Option<Regex>,
-	/// Whether to sort tags topologically.
-	pub topo_order:            Option<bool>,
+	/// Whether to sort tags chronologically.
+	pub date_order:            Option<bool>,
 	/// Sorting of the commits inside sections.
 	pub sort_commits:          Option<String>,
 }
diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs
index 46b41db..347542a 100644
--- a/git-cliff-core/src/repo.rs
+++ b/git-cliff-core/src/repo.rs
@@ -107,7 +107,7 @@ impl Repository {
 	pub fn tags(
 		&self,
 		pattern: &Option<String>,
-		topo_order: bool,
+		date_order: bool,
 	) -> Result<IndexMap<String, String>> {
 		let mut tags: Vec<(Commit, String)> = Vec::new();
 		let tag_names = self.inner.tag_names(pattern.as_deref())?;
@@ -125,7 +125,7 @@ impl Repository {
 				}
 			}
 		}
-		if !topo_order {
+		if date_order {
 			tags.sort_by(|a, b| a.0.time().seconds().cmp(&b.0.time().seconds()));
 		}
 		Ok(tags
diff --git a/git-cliff/src/args.rs b/git-cliff/src/args.rs
index 0c8e52d..e74b3c6 100644
--- a/git-cliff/src/args.rs
+++ b/git-cliff/src/args.rs
@@ -91,9 +91,9 @@ pub struct Opt {
 	/// Processes the commits that do not belong to a tag.
 	#[clap(short, long, help_heading = Some("FLAGS"))]
 	pub unreleased:   bool,
-	/// Sorts the tags topologically.
+	/// Sorts the tags chronologically.
 	#[clap(long, help_heading = Some("FLAGS"))]
-	pub topo_order:   bool,
+	pub date_order:   bool,
 	/// Strips the given parts from the changelog.
 	#[clap(short, long, value_name = "PART", arg_enum)]
 	pub strip:        Option<Strip>,
diff --git a/git-cliff/src/changelog.rs b/git-cliff/src/changelog.rs
index 5651d30..178c4c0 100644
--- a/git-cliff/src/changelog.rs
+++ b/git-cliff/src/changelog.rs
@@ -222,7 +222,7 @@ mod test {
 				tag_pattern:           None,
 				skip_tags:             Regex::new("v3.*").ok(),
 				ignore_tags:           None,
-				topo_order:            Some(false),
+				date_order:            Some(false),
 				sort_commits:          Some(String::from("oldest")),
 				link_parsers:          None,
 			},
diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs
index 6542ef7..e7deab7 100644
--- a/git-cliff/src/lib.rs
+++ b/git-cliff/src/lib.rs
@@ -107,9 +107,9 @@ pub fn run(mut args: Opt) -> Result<()> {
 				.expect("Incorrect config value for 'sort_commits'");
 		}
 	}
-	if !args.topo_order {
-		if let Some(topo_order) = config.git.topo_order {
-			args.topo_order = topo_order;
+	if !args.date_order {
+		if let Some(date_order) = config.git.date_order {
+			args.date_order = date_order;
 		}
 	}
 
@@ -118,7 +118,7 @@ pub fn run(mut args: Opt) -> Result<()> {
 		Repository::init(args.repository.unwrap_or(env::current_dir()?))?;
 
 	// Parse tags.
-	let mut tags = repository.tags(&config.git.tag_pattern, args.topo_order)?;
+	let mut tags = repository.tags(&config.git.tag_pattern, args.date_order)?;
 
 	// Skip tags.
 	let skip_regex = config.git.skip_tags.as_ref();


Test patch:
diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml
new file mode 100644
index 00000000..3d72daf
--- /dev/null
+++ b/.github/actions/run-fixtures-test/action.yml
@@ -0,0 +1,50 @@
+name: Run a fixtures test
+description: Run a fixtures test
+
+inputs:
+  fixtures-dir:
+    description: Path to the fixtures directory
+    required: true
+  command:
+    description: The git-cliff command to run
+    required: false
+    default: ""
+
+runs:
+  using: composite
+  steps:
+    - name: Install toolchain
+      uses: actions-rs/toolchain@v1
+      with:
+        profile: minimal
+        toolchain: nightly
+        override: true
+
+    - name: Install git-cliff
+      run: cargo install --path git-cliff/
+      shell: bash
+
+    - name: Set git config
+      run: |
+        git config --global user.name "github-actions[bot]"
+        git config --global user.email "github-actions[bot]@users.noreply.github.com"
+      shell: bash
+
+    - name: Create commits and tags
+      working-directory: ${{ inputs.fixtures-dir }}
+      run: |
+        git init
+        ./commit.sh
+      shell: bash
+
+    - name: Generate a changelog
+      working-directory: ${{ inputs.fixtures-dir }}
+      run: git cliff --config cliff.toml ${{ inputs.command }} > output.md
+      shell: bash
+
+    - name: Compare the output with the expected output
+      working-directory: ${{ inputs.fixtures-dir }}
+      run: |
+        cat output.md
+        diff --strip-trailing-cr output.md expected.md
+      shell: bash
diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml
new file mode 100644
index 00000000..b9f550f
--- /dev/null
+++ b/.github/fixtures/test-date-order-arg/cliff.toml
@@ -0,0 +1,27 @@
+[changelog]
+# changelog header
+header = """
+# Changelog\n
+All notable changes to this project will be documented in this file.\n
+"""
+# template for the changelog body
+# https://tera.netlify.app/docs/#introduction
+body = """
+{% if version %}\
+    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
+{% else %}\
+    ## [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+    ### {{ group | upper_first }}
+    {% for commit in commits %}
+        - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
+    {% endfor %}
+{% endfor %}\n
+"""
+# remove the leading and trailing whitespace from the template
+trim = true
+# changelog footer
+footer = """
+<!-- generated by git-cliff -->
+"""
diff --git a/.github/fixtures/test-date-order-arg/commit.sh b/.github/fixtures/test-date-order-arg/commit.sh
new file mode 100755
index 00000000..9ce4935
--- /dev/null
+++ b/.github/fixtures/test-date-order-arg/commit.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -e
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1"
+git tag v0.1.0
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2"
+git tag v0.2.0
+
+git checkout v0.1.0
+GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1"
+git tag v0.1.1
diff --git a/.github/fixtures/test-date-order-arg/expected.md b/.github/fixtures/test-date-order-arg/expected.md
new file mode 100644
index 00000000..dec0b23
--- /dev/null
+++ b/.github/fixtures/test-date-order-arg/expected.md
@@ -0,0 +1,11 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+## [0.1.1] - 2021-01-23
+
+### Feat
+
+- Fix feature 1
+
+<!-- generated by git-cliff -->
diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml
new file mode 100644
index 00000000..0d3c8e5
--- /dev/null
+++ b/.github/fixtures/test-date-order/cliff.toml
@@ -0,0 +1,30 @@
+[changelog]
+# changelog header
+header = """
+# Changelog\n
+All notable changes to this project will be documented in this file.\n
+"""
+# template for the changelog body
+# https://tera.netlify.app/docs/#introduction
+body = """
+{% if version %}\
+    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
+{% else %}\
+    ## [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+    ### {{ group | upper_first }}
+    {% for commit in commits %}
+        - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
+    {% endfor %}
+{% endfor %}\n
+"""
+# remove the leading and trailing whitespace from the template
+trim = true
+# changelog footer
+footer = """
+<!-- generated by git-cliff -->
+"""
+
+[git]
+date_order = true
diff --git a/.github/fixtures/test-date-order/commit.sh b/.github/fixtures/test-date-order/commit.sh
new file mode 100755
index 00000000..9ce4935
--- /dev/null
+++ b/.github/fixtures/test-date-order/commit.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -e
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1"
+git tag v0.1.0
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2"
+git tag v0.2.0
+
+git checkout v0.1.0
+GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1"
+git tag v0.1.1
diff --git a/.github/fixtures/test-date-order/expected.md b/.github/fixtures/test-date-order/expected.md
new file mode 100644
index 00000000..dec0b23
--- /dev/null
+++ b/.github/fixtures/test-date-order/expected.md
@@ -0,0 +1,11 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+## [0.1.1] - 2021-01-23
+
+### Feat
+
+- Fix feature 1
+
+<!-- generated by git-cliff -->
diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml
new file mode 100644
index 00000000..4f071c1
--- /dev/null
+++ b/.github/fixtures/test-ignore-tags/cliff.toml
@@ -0,0 +1,33 @@
+[changelog]
+# changelog header
+header = """
+# Changelog\n
+All notable changes to this project will be documented in this file.\n
+"""
+# template for the changelog body
+# https://tera.netlify.app/docs/#introduction
+body = """
+{% if version %}\
+    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
+{% else %}\
+    ## [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+    ### {{ group | upper_first }}
+    {% for commit in commits %}
+        - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
+    {% endfor %}
+{% endfor %}\n
+"""
+# remove the leading and trailing whitespace from the template
+trim = true
+# changelog footer
+footer = """
+<!-- generated by git-cliff -->
+"""
+
+[git]
+# regex for skipping tags
+skip_tags = "v0.1.0-beta.1"
+# regex for ignoring tags
+ignore_tags = "v.*-beta.*"
diff --git a/.github/fixtures/test-ignore-tags/commit.sh b/.github/fixtures/test-ignore-tags/commit.sh
new file mode 100755
index 00000000..7ffb277
--- /dev/null
+++ b/.github/fixtures/test-ignore-tags/commit.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+set -e
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add skip feature"
+git tag v0.1.0-beta.1
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 1"
+GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1"
+git tag v0.1.0
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:48" git commit --allow-empty -m "feat: add feature 2"
+git tag v0.2.0-beta.1
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:49" git commit --allow-empty -m "feat: add feature 3"
+git tag v0.2.0
\ No newline at end of file
diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml
new file mode 100644
index 00000000..b9f550f
--- /dev/null
+++ b/.github/fixtures/test-topo-order/cliff.toml
@@ -0,0 +1,27 @@
+[changelog]
+# changelog header
+header = """
+# Changelog\n
+All notable changes to this project will be documented in this file.\n
+"""
+# template for the changelog body
+# https://tera.netlify.app/docs/#introduction
+body = """
+{% if version %}\
+    ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
+{% else %}\
+    ## [unreleased]
+{% endif %}\
+{% for group, commits in commits | group_by(attribute="group") %}
+    ### {{ group | upper_first }}
+    {% for commit in commits %}
+        - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
+    {% endfor %}
+{% endfor %}\n
+"""
+# remove the leading and trailing whitespace from the template
+trim = true
+# changelog footer
+footer = """
+<!-- generated by git-cliff -->
+"""
diff --git a/.github/fixtures/test-topo-order/commit.sh b/.github/fixtures/test-topo-order/commit.sh
new file mode 100755
index 00000000..9ce4935
--- /dev/null
+++ b/.github/fixtures/test-topo-order/commit.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+set -e
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1"
+git tag v0.1.0
+
+GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2"
+git tag v0.2.0
+
+git checkout v0.1.0
+GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1"
+git tag v0.1.1
diff --git a/.github/fixtures/test-topo-order/expected.md b/.github/fixtures/test-topo-order/expected.md
new file mode 100644
index 00000000..a041e60
--- /dev/null
+++ b/.github/fixtures/test-topo-order/expected.md
@@ -0,0 +1,11 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+## [0.2.0] - 2021-01-23
+
+### Feat
+
+- Add feature 2
+
+<!-- generated by git-cliff -->
diff --git a/.github/workflows/test-fixtures.yml b/.github/workflows/test-fixtures.yml
index 875d362..609a2e5 100644
--- a/.github/workflows/test-fixtures.yml
+++ b/.github/workflows/test-fixtures.yml
@@ -12,41 +12,23 @@ jobs:
   test-fixtures:
     name: Test fixtures
     runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - fixtures-name: test-ignore-tags
+          - fixtures-name: test-topo-order
+            command: --latest
+          - fixtures-name: test-date-order
+            command: --latest
+          - fixtures-name: test-date-order-arg
+            command: --latest --date-order
     steps:
       - name: Checkout
         uses: actions/checkout@v2
+
+      - name: Run a fixtures test
+        uses: ./.github/actions/run-fixtures-test
         with:
-          fetch-depth: 0
-      - name: Set git config
-        run: |
-          git config --global user.name github-actions
-          git config --global user.email github-actions@github.com
-      - name: Create commits and tags
-        run: |
-          mkdir .workspace && cd .workspace && git init
-          git commit --allow-empty -m "Initial commit"
-          git commit --allow-empty -m "feat: add skip feature"
-          git tag v0.1.0-beta.1
-          git commit --allow-empty -m "feat: add feature 1"
-          git commit --allow-empty -m "feat: fix feature 1"
-          git tag v0.1.0
-          git commit --allow-empty -m "feat: add feature 2"
-          git tag v0.2.0-beta.1
-          git commit --allow-empty -m "feat: add feature 3"
-          git tag v0.2.0
-        env:
-          GIT_AUTHOR_DATE: "2021-01-23 01:23:45"
-          GIT_COMMITTER_DATE: "2021-01-23 01:23:45"
-      - name: Generate a changelog
-        run: |
-          cd .workspace
-          fixtures_dir=${GITHUB_WORKSPACE}/.github/fixtures
-          docker run -t \
-            -v "$(pwd)/.git":/app/ \
-            -v "$fixtures_dir/cliff.toml":/app/cliff.toml \
-            orhunp/git-cliff:latest > "$fixtures_dir/output.md"
-      - name: Compare the output with the expected output
-        run: |
-          cd ${GITHUB_WORKSPACE}/.github/fixtures
-          cat output.md
-          diff --strip-trailing-cr output.md expected.md
+          fixtures-dir: .github/fixtures/${{ matrix.fixtures-name }}
+          command: ${{ matrix.command }}
diff --git a/git-cliff-core/tests/integration_test.rs b/git-cliff-core/tests/integration_test.rs
index 5fb5da6..150c8af 100644
--- a/git-cliff-core/tests/integration_test.rs
+++ b/git-cliff-core/tests/integration_test.rs
@@ -59,7 +59,7 @@ fn generate_changelog() -> Result<()> {
 		tag_pattern:           None,
 		skip_tags:             None,
 		ignore_tags:           None,
-		topo_order:            None,
+		date_order:            None,
 		sort_commits:          None,
 		link_parsers:          Some(vec![
 			LinkParser {