Commit 94ecdc7 1 parent 4ec7ef7 commit 94ecdc7 Copy full SHA for 94ecdc7
File tree 3 files changed +16
-3
lines changed
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -328,7 +328,8 @@ usage: git elegant show-release-notes [<layout> | <layout> <from-reference> | <l
328
328
329
329
Generates a release notes using commits subjects between the given references.
330
330
The commits are ordered from oldest to newest. By default, the ` from-reference `
331
- is the last available tag, and the ` to-reference ` is a HEAD revision.
331
+ is the last available tag, and the ` to-reference ` is a HEAD revision. If
332
+ there are no tags, all commits will be displayed.
332
333
333
334
There are two options for a ` layout ` :
334
335
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ command-description() {
16
16
cat<< MESSAGE
17
17
Generates a release notes using commits subjects between the given references.
18
18
The commits are ordered from oldest to newest. By default, the \` from-reference\`
19
- is the last available tag, and the \` to-reference\` is a HEAD revision.
19
+ is the last available tag, and the \` to-reference\` is a HEAD revision. If
20
+ there are no tags, all commits will be displayed.
20
21
21
22
There are two options for a \` layout\` :
22
23
@@ -73,7 +74,7 @@ default() {
73
74
local first=${2:- $(last-tag)}
74
75
local second=${3:-@ }
75
76
local diapason=${first} ...${second}
76
- if [[ ${first} == all-commits ]]; then
77
+ if [[ ${first} == all-commits ]] || [[ -z ${first} ]] ; then
77
78
diapason=${second}
78
79
fi
79
80
case ${layout} in
Original file line number Diff line number Diff line change @@ -71,3 +71,14 @@ teardown() {
71
71
[[ " ${status} " -eq 43 ]]
72
72
[[ " ${lines[@]} " =~ " 'some' layout is not supported." ]]
73
73
}
74
+
75
+ @test " 'show-release-notes': displays all commits if there is no tags" {
76
+ repo " git tag | xargs git tag -d"
77
+ check git-elegant show-release-notes
78
+ [[ " ${status} " -eq 0 ]]
79
+ [[ " ${lines[0]} " == " Release notes" ]]
80
+ [[ " ${lines[1]} " == " - Add file" ]]
81
+ [[ " ${lines[2]} " == " - Add ${first} " ]]
82
+ [[ " ${lines[3]} " == " - Add ${second} " ]]
83
+ [[ " ${lines[4]} " == " - Add ${third} " ]]
84
+ }
You can’t perform that action at this time.
0 commit comments