Behaviour SwRS-MDOKFSTUDIO-CORE-094
The release adds the commit of each changelog line
The release script SHALL add to each line of the Unreleased section of CHANGELOG.md the short SHA-1 of the commit on the base that added it, as the first item of the line's reference group, and SHALL write nothing when a line's commit is not on the base or the file has uncommitted changes.
Part of StRS-MDOKFSTUDIO-CORE-007, outside the paths drawn on its map.
Scenarios 2
The situations the tests check; open one to read it.
nominalA line with a reference group and a line without
Given`## Unreleased` holds one line ending with `(CR-463 change-bar-tooltip, PR #476, issue #413)` and one line with no group, each added by a commit that is on the base
When`just changelog-refs` runs
Thenthe first line's group starts with `commit <short SHA-1 of the commit that added the line>, ` and the second line ends with ` (commit <short SHA-1>)`, written with LF line endings, and the sections of released versions are unchanged
boundaryLines the script leaves alone or refuses
| Input | Outcome |
|---|---|
| a line whose group already starts with `commit ` | left as it is; a second run changes nothing |
| a line of three physical lines, its last line edited by a later commit | the SHA-1 is the commit of its first line, written at the end of its last line |
| a line whose commit is not on the base | exit 1 naming the line and the commit, and nothing is written |
| a line whose commit is not on the base, with `--skip-missing` | the line is left unchanged and listed as skipped, the other lines get their commit, exit 0 |
| `CHANGELOG.md` has uncommitted changes | exit 1 and the file is unchanged |
| `## Unreleased` is empty | "No line to update", exit 0, the file is unchanged |