Creating links from commit comments

When Git commits are pushed, the work item references are extracted from the commit comment.

The work item references use a specific format - the comment contains certain keywords followed by the work item numbers. The format is keyword wi-num.

The supported keywords are task, defect, bug, rtcwi, work item, and workitem. The following examples are text fragments that are valid work item references when they occur in commit comments:

fix workitem 123 and test
resolve bug 123

This method is the same as the existing way to create commit links in work items (available since Rational Team Concert release 5.0).

Note: If you use third-party tools, such as GitLab, to add links to work items, configure the commit URI format. In the Git repository editor, click the Advanced tab. In the Commit URI Format field, enter $repo/commit/$sha1, where $repo is the Git repository URL and $sha1 is the commit Id. Save the changes.

Defining new keywords

With Rational Team Concert release 6.0, you can define new keywords in addition to the pre-defined keywords noted above.

New keywords are defined by using a Git configuration property named rtc.wikeywords. The property value is a comma-separated list of keywords. The following command illustrates how to define keywords:

git config --global rtc.wikeywords "ticket,issue"

The above command adds ticket and issue as two new work item keywords. After you define the keywords, you can have comment text that contains fix for ticket 100; 100 is detected as a work item reference number.

You can create the property as a global Git configuration property, so that these keywords are applied across repositories. Otherwise, ignore the --global switch in the above command.

When pushed on the Git server side, the post-receive hook recognizes the work item number from the commit comment and attempts to link with it. If successful, a Note object is created and updated for the commit.

Suppressing detection of work item from Commit comment

With Rational Team Concert release 6.0, you can use Notes objects to hold work item references without adding them in commits comments. For compatibility with an earlier version, this behavior is intact. However, you can suppress this detection by defining a Git configuration property called rtc.ignoreworkitemsfromcomment. The value of this property is a comma-separated list of keywords. The following command illustrates how to define the property: git config --global rtc.ignoreworkitemsfromcomment true

You can create the property as a global Git configuration property if you want to suppress it across repositories. Otherwise, ignore the --global switch in the above command.