Skip to content

Commit ed18c3a

Browse files
author
Gary Rennie
committed
fix(Changex.Formatter.Markdown): use Changex.Formatter.current_version
Previously, when running `mix changex.diff` the output would use version specified in `mix.exs` - this would result in inconsistent results when comparing with git tags. The `current_version` function that is included when `use Changex.Formatter` is called is now used instead. The test has also been updated to reflect this change.
1 parent 45b77c5 commit ed18c3a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/changex/formatter/markdown.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Changex.Formatter.Markdown do
2+
use Changex.Formatter
23

34
@moduledoc """
45
Format changelog to the terminal in markdown format.
@@ -46,7 +47,7 @@ defmodule Changex.Formatter.Markdown do
4647
end
4748

4849
defp heading(version) do
49-
"# #{(version || Keyword.get(Mix.Project.config, :version))}\n"
50+
"# #{(version || current_version)}\n"
5051
end
5152

5253
defp types(commits, opts) do

test/changex/formatter/markdown_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule Changex.Formatter.MarkdownTest do
2424

2525
test "Formatting with an implicit version", %{commits: commits} do
2626
version = Keyword.get(Mix.Project.config, :version)
27-
assert Changex.Formatter.Markdown.format(commits) == expected_markdown(version)
27+
assert Changex.Formatter.Markdown.format(commits) == expected_markdown("v#{version}")
2828
end
2929

3030
test "Formatting with a github url", %{commits: commits} do

0 commit comments

Comments
 (0)