File tree 6 files changed +126
-18
lines changed
test-submodules-include-path
6 files changed +126
-18
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,6 @@ All notable changes to this project will be documented in this file.
22
22
- Submodule_two with initial commits
23
23
- Submodule_two update 1
24
24
25
- ### Submodule_one
26
-
27
- #### Bug Fixes
28
-
29
- - Submodule_one fix A
30
-
31
- #### Features
32
-
33
- - Submodule_one feature A
34
- - Submodule_one initial commit
35
-
36
-
37
25
### Submodule_two
38
26
39
27
#### Bug Fixes
Original file line number Diff line number Diff line change
1
+ # git-cliff ~ configuration file
2
+ # https://git-cliff.org/docs/configuration
3
+
4
+ [changelog ]
5
+ # A Tera template to be rendered for each release in the changelog.
6
+ # See https://keats.github.io/tera/docs/#introduction
7
+ body = """
8
+ {% if version %}\
9
+ ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
10
+ {% else %}\
11
+ ## [unreleased]
12
+ {% endif %}\
13
+ {% for group, commits in commits | group_by(attribute="group") %}
14
+ ### {{ group | upper_first }}
15
+ {% for commit in commits %}
16
+ - {{ commit.message | upper_first }}\
17
+ {% endfor %}
18
+ {% endfor %}\
19
+ {% for submodule_path, commits in submodule_commits %}
20
+ ### {{ submodule_path | upper_first }}
21
+ {% for group, commits in commits | group_by(attribute="group") %}
22
+ #### {{ group | upper_first }}
23
+ {% for commit in commits %}
24
+ - {{ commit.message | upper_first }}\
25
+ {% endfor %}
26
+ {% endfor %}
27
+ {% endfor %}\n
28
+ """
29
+
30
+ [git ]
31
+ # An array of regex based parsers for extracting data from the commit message.
32
+ # Assigns commits to groups.
33
+ # Optionally sets the commit's `scope` and can decide to exclude commits from further processing.
34
+ commit_parsers = [
35
+ { message = " ^feat" , group = " Features" , default_scope = " app" },
36
+ { message = " ^fix" , group = " Bug Fixes" , scope = " cli" },
37
+ ]
38
+ recurse_submodules = true
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -e
3
+
4
+ current_dir=" $( pwd) "
5
+ submodule_one_dir=" $( mktemp -d) "
6
+ submodule_two_dir=" $( mktemp -d) "
7
+
8
+ cd $submodule_one_dir && git init >&2
9
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:8" git commit --allow-empty -m " feat: submodule_one initial commit"
10
+
11
+ cd $submodule_two_dir && git init >&2
12
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:12" git commit --allow-empty -m " feat: submodule_two feature B"
13
+
14
+ cd $current_dir
15
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:08" git commit --allow-empty -m " Initial commit"
16
+
17
+ git -c protocol.file.allow=always submodule add $submodule_one_dir submodule_one
18
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:09" git commit -a -m " feat: add submodule_one"
19
+
20
+ cd submodule_one
21
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:10" git commit --allow-empty -m " feat: submodule_one feature A"
22
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:11" git commit --allow-empty -m " fix: submodule_one fix A"
23
+ cd ..
24
+
25
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:10" git commit -a -m " feat: submodule_one update 1"
26
+ git tag v0.1.0
27
+
28
+ git -c protocol.file.allow=always submodule add $submodule_two_dir submodule_two
29
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:11" git commit -a -m " feat: submodule_two with initial commits"
30
+
31
+ cd submodule_two
32
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:13" git commit --allow-empty -m " fix: submodule_two fix B"
33
+ cd ..
34
+
35
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:12" git commit -a -m " feat: submodule_two update 1"
36
+ git tag v0.2.0
37
+
38
+ cd submodule_two
39
+ GIT_COMMITTER_DATE=" 2022-04-05 01:00:14" git commit --allow-empty -m " fix: submodule_two fix C"
40
+ cd ..
41
+
42
+ GIT_COMMITTER_DATE=" 2022-04-06 01:25:13" git commit -a -m " feat: submodule_two update 2"
Original file line number Diff line number Diff line change
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [ unreleased]
6
+
7
+ ### Features
8
+
9
+ - Submodule_two update 2
10
+
11
+ ### Submodule_two
12
+
13
+ #### Bug Fixes
14
+
15
+ - Submodule_two fix C
16
+
17
+
18
+ ## [ 0.2.0] - 2022-04-06
19
+
20
+ ### Features
21
+
22
+ - Submodule_two with initial commits
23
+ - Submodule_two update 1
24
+
25
+ ### Submodule_two
26
+
27
+ #### Bug Fixes
28
+
29
+ - Submodule_two fix B
30
+
31
+ #### Features
32
+
33
+ - Submodule_two feature B
34
+
35
+
36
+ <!-- generated by git-cliff -->
Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ jobs:
117
117
- fixtures-name : test-require-conventional-negative
118
118
- fixtures-name : test-require-conventional-skipped
119
119
- fixtures-name : test-submodules
120
+ - fixtures-name : test-submodules-range
121
+ command : v0.1.0..HEAD
120
122
- fixtures-name : test-submodules-include-path
121
123
command : --include-path submodule_two
122
124
- fixtures-name : test-remote-config
Original file line number Diff line number Diff line change @@ -172,6 +172,8 @@ fn process_submodules(
172
172
. clone ( )
173
173
. and_then ( |commit_id| repository. find_commit ( & commit_id) ) ;
174
174
175
+ trace ! ( "Processing submodule commits in {first_commit:?}..{last_commit:?}" ) ;
176
+
175
177
// Query repository for submodule changes. For each submodule a
176
178
// SubmoduleRange is created, describing the range of commits in the context
177
179
// of that submodule.
@@ -388,12 +390,6 @@ fn process_repository<'a>(
388
390
releases. last_mut ( ) . unwrap ( ) . previous = Some ( Box :: new ( previous_release) ) ;
389
391
}
390
392
391
- if recurse_submodules {
392
- for release in & mut releases {
393
- process_submodules ( repository, release, config. git . topo_order_commits ) ?;
394
- }
395
- }
396
-
397
393
if args. sort == Sort :: Newest {
398
394
for release in & mut releases {
399
395
release. commits . reverse ( ) ;
@@ -443,6 +439,12 @@ fn process_repository<'a>(
443
439
}
444
440
}
445
441
442
+ if recurse_submodules {
443
+ for release in & mut releases {
444
+ process_submodules ( repository, release, config. git . topo_order_commits ) ?;
445
+ }
446
+ }
447
+
446
448
// Set custom message for the latest release.
447
449
if let Some ( message) = & args. with_tag_message {
448
450
if let Some ( latest_release) = releases
You can’t perform that action at this time.
0 commit comments