Update 'git fixes' alias and the documentation to point to Gitlab

This commit is contained in:
Maciej Suminski 2019-12-01 10:44:04 +01:00
parent 07c6cfdc38
commit 2a3d4ffe88
2 changed files with 16 additions and 18 deletions

View File

@ -8,18 +8,20 @@ from the subject line by a blank line and wrapped at 72 characters. The body
of a commit message should explain what the commit does and why. Do not of a commit message should explain what the commit does and why. Do not
explain *how* the changes work as the code itself should do that. explain *how* the changes work as the code itself should do that.
# Linking a commit to a bug report # {#commit_bug_link} # Linking a commit to an issue # {#commit_bug_link}
If your commit fixes a bug that has been reported in the [Launchpad bug If your commit fixes an issue that has been reported in the [issue
tracker](https://bugs.launchpad.net/kicad/+bugs), end your commit with the tracker](https://gitlab.com/kicad/code/kicad/issues), add a line indicating the
following lines to mark it as fixed, where `1234567` represents the actual fixed issue number to your commit message. In such case, Gitlab will
bug ID. A bot will automatically set the bug status to "Fix Committed" and automatically close the issue and add a link to your commit in the issue.
link to the commit once it is merged.
Fixes: lp:1234567 For example, the following line will automatically close issue #1234567:
https://bugs.launchpad.net/kicad/+bug/1234567
Fixes #1234567 | https://gitlab.com/kicad/code/kicad/issues/1234567
There is an [alias](#commit_fixes_alias) to simplify this step. There is an [alias](#commit_fixes_alias) to simplify this step.
You can read more about automatic issue closing in the
[Gitlab documentation](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically).
# Changelog tags {#commit_changelog_tag} # Changelog tags {#commit_changelog_tag}
@ -68,11 +70,8 @@ Following is an example of a properly formatted commit message:
CHANGED: "Wire" lines now optionally include data on the line style, CHANGED: "Wire" lines now optionally include data on the line style,
width and color if they differ from the default. width and color if they differ from the default.
Fixes: lp:594059 Fixes #594059 | https://gitlab.com/kicad/code/kicad/issues/594059
* https://bugs.launchpad.net/kicad/+bug/594059 Fixes #1405026 | https://gitlab.com/kicad/code/kicad/issues/1405026
Fixes: lp:1405026
* https://bugs.launchpad.net/kicad/+bug/1405026
# Git aliases file # {#commit_git_aliases} # Git aliases file # {#commit_git_aliases}
@ -88,10 +87,9 @@ most recent commit to include the bug report link:
git fixes 1234567 git fixes 1234567
The example command would add the following lines to the last commit message: For example, the command below will append a line to the last commit message:
Fixes: lp:1234567 Fixes #1234567 | https://gitlab.com/kicad/code/kicad/issues/1234567
* https://bugs.launchpad.net/kicad/+bug/1234567
## 'changelog' alias # {#commit_changelog_alias} ## 'changelog' alias # {#commit_changelog_alias}

View File

@ -1,13 +1,13 @@
[alias] [alias]
# Alias to simplify marking commits as bug fixes # Alias to simplify marking commits as bug fixes
# When the script is enabled, you may commit a change and run 'git fixes 123456' to mark the commit as a fix to bug lp:123456 # Once the script is enabled, commit your changes and run 'git fixes 123456' to mark the last commit as a fix for issue #123456
# Enable by executing in the source root directory: # Enable by executing in the source root directory:
# git config --add include.path $(pwd)/helpers/git/fixes_alias # git config --add include.path $(pwd)/helpers/git/fixes_alias
fixes = "!f() { \ fixes = "!f() { \
COMMIT_MSG=$(git log -1 --format=medium | tail -n +5 | sed -e 's/^ //'); \ COMMIT_MSG=$(git log -1 --format=medium | tail -n +5 | sed -e 's/^ //'); \
git commit --amend -m \"${COMMIT_MSG}\n\nFixes: lp:$1\n* https://bugs.launchpad.net/kicad/+bug/$1\"; \ git commit --amend -m \"${COMMIT_MSG}\n\nFixes #$1 | https://gitlab.com/kicad/code/kicad/issues/$1\"; \
}; f" }; f"