Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit sotring is unstable #209

@ikedam

Description

@ikedam

Expected Behavior

The order of log entries are always same for any configurations if options.commits.sort_by is not changed.

Actual Behavior

The order of log entries differs for different configurations, even if options.commits.sort_by is not changed.
This means the sorting for commit is performed with an unstable sort algorithm.

Steps to Reproduce (including precondition)

  1. Create a changelog for git-chglog@v0.11.0:

    $ ./git-chglog v0.11.0 >changelog1.md 
    
  2. Change the configuration:

    diff --git a/.chglog/config.yml b/.chglog/config.yml
    index 074a182..5473a51 100755
    --- a/.chglog/config.yml
    +++ b/.chglog/config.yml
    @@ -20,7 +20,7 @@ options:
           refactor: Code Refactoring
           chore: Chores
       header:
    -    pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
    +    pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(update module .*)$"
         pattern_maps:
           - Type
           - Scope
    
    • This means to generate a changelog only with logs started with "update module ...".
  3. Create a changelog for git-chglog@v0.11.0 with the new configuration:

    $ ./git-chglog v0.11.0 >changelog2.md 
    
  4. Compare them:

    $ diff -u changelog1.md changelog2.md
    
    • Attached this output: diff_of_changelogs.txt
    • There are differences not only for removed lines but also for added lines. This is caused for the order of logs changed.

I found this behavior when I updated the git-chglog configuration for my repository to pick new commits. I expected new logs, but didn't expected changing the order of logs.

Screenshot on This Problem (if possible)

N/A

Your Environment

  • OS: golang:1.19.1-bullseye (Tested with docker)
  • git-chglog version: v0.15.1 (Built in golang:1.19.1-bullseye)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions