Skip to content

feat: recurse into submodules - #1082

Merged
orhun merged 44 commits into
orhun:mainfrom
lehmanju:submodules-2
Apr 10, 2025
Merged

feat: recurse into submodules#1082
orhun merged 44 commits into
orhun:mainfrom
lehmanju:submodules-2

Conversation

@lehmanju

@lehmanju lehmanju commented Mar 7, 2025

Copy link
Copy Markdown
Contributor

Usage

If recurse_submodules is set to true, you can include submodule commits into your changelog.

For example:

[git]
recurse_submodules = true

[changelog]
body = """
{% for submodule_path, commits in submodule_commits %}
    ### {{ submodule_path | upper_first }}
    {% for group, commits in commits | group_by(attribute="group") %}
        #### {{ group | upper_first }}
        {% for commit in commits %}
            - {{ commit.message | upper_first }}\
        {% endfor %}
    {% endfor %}
{% endfor %}\n
"""

Implementation details

Adds a feature which allows git-cliff to recurse into submodules of a repository. Between two subsequent releseases in the main repository, all submodule commits in between are expanded. For each submodule, there is an entry in submodule_commits mapping the submodules path to a list of commits. This feature is off by default (recurse_submodules=false). Nested submodules are not supported.

@welcome

welcome Bot commented Mar 7, 2025

Copy link
Copy Markdown

Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️

@codecov-commenter

codecov-commenter commented Mar 7, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 24.46809% with 71 lines in your changes missing coverage. Please review.

Project coverage is 40.29%. Comparing base (aec41be) to head (836b1f6).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
git-cliff/src/lib.rs 0.00% 28 Missing ⚠️
git-cliff-core/src/repo.rs 0.00% 24 Missing ⚠️
git-cliff-core/src/changelog.rs 53.66% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1082      +/-   ##
==========================================
- Coverage   41.09%   40.29%   -0.79%     
==========================================
  Files          21       21              
  Lines        1845     1894      +49     
==========================================
+ Hits          758      763       +5     
- Misses       1087     1131      +44     
Flag Coverage Δ
unit-tests 40.29% <24.47%> (-0.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yudjinn

yudjinn commented Mar 7, 2025

Copy link
Copy Markdown

Nice! So for a given commit range of the containing repo, this returns all submodules that changed within those commits, and their deltas between them?

@yudjinn

yudjinn commented Mar 7, 2025

Copy link
Copy Markdown

This is actually an improvement and "replaces" some of what I was trying to do, and I'm super happy to see it ☺️ if I have time this weekend I'll try to use this as the basis for the releases instead of my other way

@lehmanju

lehmanju commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

Well, this iteration sort of actually works! However, the submodule path is not correct ...
context.json

I used openstack/openstack for testing btw, that repository does seem like the ultimate stresstest.

@lehmanju

lehmanju commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

So that is fixed as well, only config option, documentation and code cleanup/review are missing.

@orhun

orhun commented Mar 7, 2025

Copy link
Copy Markdown
Owner

This is some good stuff. Let me know when this is ready for review :)

@lehmanju lehmanju left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about some naming conventions and what should be tested/where. other than that its finished but still needs some testing with a real changelog template.

Comment thread git-cliff-core/Cargo.toml Outdated
Comment thread git-cliff-core/src/changelog.rs
Comment thread git-cliff-core/src/commit.rs
Comment thread git-cliff-core/src/release.rs Outdated
Comment thread git-cliff-core/src/repo.rs Outdated
@lehmanju lehmanju changed the title feat(repo): get submodule repositories with commit ranges feat: Submodule commit processing Mar 7, 2025
@lehmanju
lehmanju marked this pull request as ready for review March 7, 2025 21:48
@lehmanju
lehmanju requested a review from orhun as a code owner March 7, 2025 21:48
Comment thread git-cliff/src/lib.rs Outdated

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

Some things to do:

  • Add fixture tests to ensure the functionality
  • Update documentation about the new configuration option

Comment thread git-cliff-core/src/release.rs Outdated
Comment thread git-cliff-core/src/repo.rs Outdated
Comment thread git-cliff-core/src/repo.rs Outdated
Comment thread git-cliff-core/src/repo.rs Outdated
Comment thread git-cliff/Cargo.toml Outdated
Comment thread git-cliff/Cargo.toml Outdated
Comment thread git-cliff/src/lib.rs Outdated
Comment thread git-cliff/src/lib.rs Outdated
Comment thread git-cliff-core/Cargo.toml Outdated
Comment thread git-cliff-core/src/changelog.rs
@lehmanju

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I'll have time to address your comments in about a week.

@lehmanju

Copy link
Copy Markdown
Contributor Author

@orhun If CI turns out good (which it should), this is ready for a (hopefully) final review.

  • docs updated
  • fixture tests improved
  • edge cases (submodule added/removed) working
  • releases without commit id working

@lehmanju
lehmanju requested a review from orhun March 24, 2025 15:49

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, this looks great! Only a couple of tweaks left:

  • I left a review about the fixture configs, they can be simplified.
  • Can you update the default config (config/cliff.toml) and include the recurse_submodules there?
  • Lastly, we need to rebase on main :)

And sorry for late review, I've been traveling...

Comment thread .github/fixtures/test-submodules-include-path/cliff.toml
Comment thread .github/fixtures/test-submodules/cliff.toml
@lehmanju lehmanju changed the title feat: Submodule commit processing feat: recurse into submodules Apr 7, 2025
@lehmanju

lehmanju commented Apr 7, 2025

Copy link
Copy Markdown
Contributor Author

@orhun addressed your review and fixed conflicts. additionally, the description and title has been updated to make this pr ready for squash merge.

@lehmanju
lehmanju requested a review from orhun April 10, 2025 09:29

@orhun orhun left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat feature, thank you very much for your contribution!

@orhun
orhun merged commit 4a3c0c0 into orhun:main Apr 10, 2025
@welcome

welcome Bot commented Apr 10, 2025

Copy link
Copy Markdown

Congrats on merging your first pull request! ⛰️

This was referenced Apr 10, 2025
@lehmanju

Copy link
Copy Markdown
Contributor Author

Woohoo, nice!

@lehmanju

Copy link
Copy Markdown
Contributor Author

Any chance to get a new release by Monday? This would really help me at my job.

@orhun

orhun commented Apr 12, 2025

Copy link
Copy Markdown
Owner

I was already planning a release soon, I'll try to push it sooner :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants