commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

fix(bump)!: only add version files and staged changes

Open marcusalstrom opened this issue 1 year ago • 4 comments

Description

Bump will now only add and commit version files along with any already committed changes. Any unstaged changes will remain unstaged.

NOTE: BREAKING CHANGE, since we added a new abstract method to VersionProvider any custom version provider will break. (open to any suggestions on how to avoid this)

Checklist

  • [x] Add test cases to all the changes you introduce
  • [x] Run ./scripts/format and ./scripts/test locally to ensure this change passes linter check and test
  • [x] Test the changes on the local machine manually
  • [x] Update the documentation for the changes

Expected behavior

Only version files and already staged changes will be committed on bump.

Steps to Test This Pull Request

  1. cz bump with unstaged changes
  2. only version files (and any staged changes) will be added and committed, unstaged changes will remain unstaged

Additional context

References issue #1194

marcusalstrom avatar Oct 15 '24 09:10 marcusalstrom

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (v5@eafcef6). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff          @@
##             v5    #1261   +/-   ##
=====================================
  Coverage      ?   97.64%           
=====================================
  Files         ?       55           
  Lines         ?     2594           
  Branches      ?        0           
=====================================
  Hits          ?     2533           
  Misses        ?       61           
  Partials      ?        0           
Flag Coverage Δ
unittests 97.64% <100.00%> (?)

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 15 '24 09:10 codecov[bot]

As this is breaking change, I change the base branch to v4

Lee-W avatar Nov 10 '24 02:11 Lee-W

In general, I like this idea. @woile @noirbizarre would love to know your thought 🙂

Lee-W avatar Nov 10 '24 02:11 Lee-W

No unexpected extra file in release, I like this idea too, but it should include the changelog too if the option is set.

If it was possible to bump a dirty working copy, this is obviously a breaking change, and we should provide a way around this. Maybe a setting and param --allow-changed-files as version files are parsed for version and updated and some may have a process in which they stage their change to be taken in the bump without wanting version updated in this file

noirbizarre avatar Nov 28 '24 00:11 noirbizarre