Skip to content

Commit

Permalink
fix: Generate duplicate commit
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Dec 29, 2020
1 parent 63d1118 commit b7fa03c
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 217 deletions.
32 changes: 15 additions & 17 deletions 2_extractor/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,34 +80,32 @@ func Extract(g *client.GitClient, scopes []*parser.Scope) ([]*ExtractSplice, err
break
}

commit := commits[index]
currentCommit := commits[index]

item := &ExtractSplice{
Name: "Unreleased",
Commit: make([]*object.Commit, 0),
}

if len(scope.Tags) != 0 {
if tags := getTagOfCommit(scope.Tags, commit); len(tags) != 0 {
if tagIndex+1 == len(tags) {
item.Tag = tags[tagIndex]
item.Name = tags[tagIndex].Name
item.Commit = append(item.Commit, commit)
tagIndex = 0 // reset tag index to zero
} else {
item.Tag = tags[tagIndex]
item.Name = tags[tagIndex].Name
splices = append(splices, item)
tagIndex++
continue
}
if tags := getTagOfCommit(scope.Tags, currentCommit); len(tags) != 0 {
if tagIndex+1 == len(tags) {
item.Tag = tags[tagIndex]
item.Name = tags[tagIndex].Name
item.Commit = append(item.Commit, currentCommit)
tagIndex = 0 // reset tag index to zero
} else {
item.Tag = tags[tagIndex]
item.Name = tags[tagIndex].Name
splices = append(splices, item)
tagIndex++
continue
}
} else {
item.Commit = append(item.Commit, currentCommit)
}

index++

item.Commit = append(item.Commit, commit)

loop:
for {
if index == len(commits) {
Expand Down
33 changes: 13 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ Unreleased (2020-12-30)

### πŸ”₯ New feature:

- **BREAKING**: update generation template.([`20dfe73`](https://github.com/axetroy/changelog/commit/20dfe7361a679e64abd9ec2ba8d59f935627ebfe)) (thanks @axetroy)
- support release date for generation. close #16([`4e9b59a`](https://github.com/axetroy/changelog/commit/4e9b59a5fbbe8c62d782e0350273fb5980e52b48)) (thanks @axetroy)

### πŸ’ͺ Commits(2):
### πŸ’ͺ Commits(4):

- [`63d1118`](https://github.com/axetroy/changelog/commit/63d1118a4ce3051b91059be2dee52d595690628f) - v0.3.0
- [`20dfe73`](https://github.com/axetroy/changelog/commit/20dfe7361a679e64abd9ec2ba8d59f935627ebfe) - feat(BREAKING): update generation template.
- [`4e9b59a`](https://github.com/axetroy/changelog/commit/4e9b59a5fbbe8c62d782e0350273fb5980e52b48) - feat: support release date for generation. close #16
- [`21817fa`](https://github.com/axetroy/changelog/commit/21817fa1aba8d1e71b5fe73ba4047dc08eae197b) - chore: update sum file

Expand All @@ -22,9 +25,8 @@ v0.2.7 (2020-12-29)
- generate incorrect in mutiple version for same commit. close #15([`8fd5818`](https://github.com/axetroy/changelog/commit/8fd58182b02ea657c37c09e4a734a48215eaffb6)) (thanks @axetroy)
- **deps**: update dependency ant-design-vue to v2.0.0-rc.3 (#14)([`e6275b7`](https://github.com/axetroy/changelog/commit/e6275b7d7f7b009e79a70f6f869efebb9dc7a866)) (thanks @renovate[bot])

### πŸ’ͺ Commits(7):
### πŸ’ͺ Commits(6):

- [`aa904db`](https://github.com/axetroy/changelog/commit/aa904db8a94b965365aa796518002c92e1158f4e) - v0.2.7
- [`aa904db`](https://github.com/axetroy/changelog/commit/aa904db8a94b965365aa796518002c92e1158f4e) - v0.2.7
- [`dd4c86f`](https://github.com/axetroy/changelog/commit/dd4c86f61ff127b74b82d48d0919fc603651163e) - test: update testcase
- [`8fd5818`](https://github.com/axetroy/changelog/commit/8fd58182b02ea657c37c09e4a734a48215eaffb6) - fix: generate incorrect in mutiple version for same commit. close #15
Expand All @@ -39,9 +41,8 @@ v0.2.6 (2020-12-07)

- npm binary([`8384bf7`](https://github.com/axetroy/changelog/commit/8384bf782d8adf1627082f3e9030ed4a88c0fa5a)) (thanks @axetroy)

### πŸ’ͺ Commits(4):
### πŸ’ͺ Commits(3):

- [`f055c6f`](https://github.com/axetroy/changelog/commit/f055c6f1033d3b559007f4e3449227067d31fdfb) - v0.2.6
- [`f055c6f`](https://github.com/axetroy/changelog/commit/f055c6f1033d3b559007f4e3449227067d31fdfb) - v0.2.6
- [`46944c6`](https://github.com/axetroy/changelog/commit/46944c641ff26417b77c8210b89c5ca09a1d2480) - chore(npm): auto bump version
- [`8384bf7`](https://github.com/axetroy/changelog/commit/8384bf782d8adf1627082f3e9030ed4a88c0fa5a) - fix: npm binary
Expand All @@ -53,19 +54,17 @@ v0.2.5 (2020-12-05)

- **npm**: missing postinstall script([`6209122`](https://github.com/axetroy/changelog/commit/6209122eacda6d86421a6955dad86785d0206b4b)) (thanks @axetroy)

### πŸ’ͺ Commits(4):
### πŸ’ͺ Commits(3):

- [`91f3fa9`](https://github.com/axetroy/changelog/commit/91f3fa9c27b6421694be6b67308533049d8adbf4) - v0.2.5
- [`91f3fa9`](https://github.com/axetroy/changelog/commit/91f3fa9c27b6421694be6b67308533049d8adbf4) - v0.2.5
- [`6209122`](https://github.com/axetroy/changelog/commit/6209122eacda6d86421a6955dad86785d0206b4b) - fix(npm): missing postinstall script
- [`9650595`](https://github.com/axetroy/changelog/commit/9650595bba4aea0c11fbd1ec82eb6a676f7daa75) - chore(deps): update dependency sass to v1.30.0 (#13)

v0.2.4 (2020-12-05)
-------------------

### πŸ’ͺ Commits(4):
### πŸ’ͺ Commits(3):

- [`2872a05`](https://github.com/axetroy/changelog/commit/2872a056e2772feffbdcd0adc73bd1c0c64c6127) - v0.2.4
- [`2872a05`](https://github.com/axetroy/changelog/commit/2872a056e2772feffbdcd0adc73bd1c0c64c6127) - v0.2.4
- [`9dff4fc`](https://github.com/axetroy/changelog/commit/9dff4fc6a9d746ffd9dd10215cf04d2fec2edd2a) - update
- [`c7bc358`](https://github.com/axetroy/changelog/commit/c7bc35835361afd5ddffaa8a157513cf83b4b24b) - chore: update
Expand All @@ -81,9 +80,8 @@ v0.2.3 (2020-12-05)

- **deps**: pin dependencies (#11)([`bfc347c`](https://github.com/axetroy/changelog/commit/bfc347c7d945e6ba47787758ba88bc6940d1341a)) (thanks @renovate[bot])

### πŸ’ͺ Commits(7):
### πŸ’ͺ Commits(6):

- [`4474fb8`](https://github.com/axetroy/changelog/commit/4474fb8b40e54b6cd6e776e53dc0df895379c048) - v0.2.3
- [`4474fb8`](https://github.com/axetroy/changelog/commit/4474fb8b40e54b6cd6e776e53dc0df895379c048) - v0.2.3
- [`09cb54d`](https://github.com/axetroy/changelog/commit/09cb54d8772bbecf03f98d5559bb02973423d14a) - ci: add npm publish
- [`bfc347c`](https://github.com/axetroy/changelog/commit/bfc347c7d945e6ba47787758ba88bc6940d1341a) - fix(deps): pin dependencies (#11)
Expand All @@ -96,12 +94,10 @@ v0.2.2 (2020-12-04)

### πŸ› Bugs fixed:

- path handler([`58d7a2d`](https://github.com/axetroy/changelog/commit/58d7a2d8d04bc99adf0b6a19e0a74261ab48f477)) (thanks @axetroy)
- path handler([`58d7a2d`](https://github.com/axetroy/changelog/commit/58d7a2d8d04bc99adf0b6a19e0a74261ab48f477)) (thanks @axetroy)

### πŸ’ͺ Commits(2):
### πŸ’ͺ Commits(1):

- [`58d7a2d`](https://github.com/axetroy/changelog/commit/58d7a2d8d04bc99adf0b6a19e0a74261ab48f477) - fix: path handler
- [`58d7a2d`](https://github.com/axetroy/changelog/commit/58d7a2d8d04bc99adf0b6a19e0a74261ab48f477) - fix: path handler

v0.2.1 (2020-12-04)
Expand All @@ -119,9 +115,8 @@ v0.2.1 (2020-12-04)
- playground([`a867126`](https://github.com/axetroy/changelog/commit/a8671265554c3ded3d20c8e1fbdb6e55ebc133f2)) (thanks @axetroy)
- **playground**: error logo([`3fa90ed`](https://github.com/axetroy/changelog/commit/3fa90eda1cc98378f4d5a8197682405ebbe92532)) (thanks @axetroy)

### πŸ’ͺ Commits(23):
### πŸ’ͺ Commits(22):

- [`a94f18f`](https://github.com/axetroy/changelog/commit/a94f18fbd2561d9b12735544e9e9b632c4ab15b0) - docs: update readme
- [`a94f18f`](https://github.com/axetroy/changelog/commit/a94f18fbd2561d9b12735544e9e9b632c4ab15b0) - docs: update readme
- [`952ac0e`](https://github.com/axetroy/changelog/commit/952ac0ed4c34dacf55ae399b3b5d8a7f5cac0cfa) - refactor: remove console
- [`2b7c5d4`](https://github.com/axetroy/changelog/commit/2b7c5d4dc4809ce00f5dc48bd15445fd10e8fcbd) - refactor: improve dir detect
Expand Down Expand Up @@ -207,9 +202,8 @@ v0.2.0 (2020-11-27)
+ $ whatchanged --help
```

### πŸ’ͺ Commits(59):
### πŸ’ͺ Commits(58):

- [`f55c367`](https://github.com/axetroy/changelog/commit/f55c3677031bbcf295684d2f0510ef838ab10ad4) - ci: update whatchanged command options
- [`f55c367`](https://github.com/axetroy/changelog/commit/f55c3677031bbcf295684d2f0510ef838ab10ad4) - ci: update whatchanged command options
- [`749a021`](https://github.com/axetroy/changelog/commit/749a021a56fb4467d2e2bc5e4416ba3d87754c8d) - docs: update changelog
- [`8608c37`](https://github.com/axetroy/changelog/commit/8608c37b4bffd7971f31333a13b06181daa5f9bd) - v0.2.0
Expand Down Expand Up @@ -293,9 +287,8 @@ v0.1.0 (2020-11-24)
- if empty argument for command line([`9c79fd9`](https://github.com/axetroy/changelog/commit/9c79fd91bbf88f7861b4aca89ced8384cf2b9bcd)) (thanks @axetroy)
- **ci**: remove unsued code([`66bcf8f`](https://github.com/axetroy/changelog/commit/66bcf8f43db85409e0392c93f2e347ed91699e81)) (thanks @axetroy)

### πŸ’ͺ Commits(44):
### πŸ’ͺ Commits(43):

- [`7a3fd6d`](https://github.com/axetroy/changelog/commit/7a3fd6de68462fb64266bf3f606e957d32cdc2ae) - ci: add release template
- [`7a3fd6d`](https://github.com/axetroy/changelog/commit/7a3fd6de68462fb64266bf3f606e957d32cdc2ae) - ci: add release template
- [`00d6cc7`](https://github.com/axetroy/changelog/commit/00d6cc7bdf42d6a0b58cf15e0aea65710f1efbf1) - ci: debug
- [`e6f97da`](https://github.com/axetroy/changelog/commit/e6f97daba33e8c912ee738e4fceb2bf3da877cee) - ci: debug
Expand Down
Loading

0 comments on commit b7fa03c

Please sign in to comment.