Commit-based-Distribution / commit-based-distribution

Commit-based Distribution (CBD) is an alternative to semantic release for projects following OneFlow, Semantic versioning and Conventional commits
MIT License
5 stars 0 forks source link

Resilient to rewriting history #2

Open ecattez opened 1 year ago

ecattez commented 1 year ago

Rule

CBD must be resilient when the git history is squashed or forced to change.

Background

Current tag: 0.2.0 (c5)

Commit hash Short message
c1 init project
c2 feat: first feature
c3 refactor: some refacto
c4 fix: a bug to fix
c5 feat(some scope): second feature
c6 tech: some tech
c7 doc(readme): write some doc

Example 1: Rewriting history did not affect versioning

-- Squash from c1 to c6 --
Commit hash Short message
cA feat: epic one is done
c7 doc(readme): write some doc

Expected tag: 0.2.0 (c5)

Example 2: Squash to feat with additional changes

-- Squash from c1 to c6 --
+ some changes
Commit hash Short message
cA feat: epic one is done with some changes
c7 doc(readme): write some doc

Expected tag: 0.3.0 (cA)

Example 3: Squash to fix with additional changes

-- Squash from c1 to c6 --
+ some changes
Commit hash Short message
cA fix: epic one is done with some changes
c7 doc(readme): write some doc

Expected tag: 0.2.1 (cA)

Example 4: Squash to breaking changes with additional changes

-- Squash from c1 to c6 --
+ some changes
Commit hash Short message
cA epic!: epic one is done with some changes
c7 doc(readme): write some doc

Expected tag: 1.0.0 (cA)