Guillaume Aubert > App-GitHooks-Plugin-PrependTicketID-v1.0.1 > App::GitHooks::Plugin::PrependTicketID

Download:
App-GitHooks-Plugin-PrependTicketID-v1.0.1.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: v1.0.1   Source  

NAME ^

App::GitHooks::Plugin::PrependTicketID - Derive a ticket ID from the branch name and prepend it to the commit-message.

DESCRIPTION ^

If you are using the App::GitHooks::Plugin::RequireTicketID to force entering a ticket ID with each commit, it can become tedious if you need to do a lot of commits with the same ticket ID on a feature branch.

To help with this, this plugin derives a ticket ID from the branch name and prepends it to the commit message.

VERSION ^

Version 1.0.1

CONFIGURATION OPTIONS ^

This plugin supports the following options in the main section of your .githooksrc file.

        project_prefixes = DEV
        extract_ticket_id_from_branch = /^($project_prefixes\d+)/
        normalize_branch_ticket_id = s/^(.*?)(\d+)$/\U$1-$2/

project_prefixes

The list of valid ticket prefixes.

        project_prefixes = OPS, DEV, TEST

extract_ticket_id_from_branch

A regular expression with one capturing group that will extract the ticket ID from a branch name.

        extract_ticket_id_from_branch = /^($project_prefixes\d+)/

In the example above, if a branch is named dev1293_my_new_feature, the regular expression will identify dev1293 as the ticket ID corresponding to that branch.

Note that:

normalize_branch_ticket_id

A replacement expression to normalize the ticket ID extracted with extract_ticket_id_from_branch.

        normalize_branch_ticket_id = s/^(.*?)(\d+)$/\U$1-$2/

In the example above, dev1293_my_new_feature gave dev1293, which is then normalized as DEV-1293.

METHODS ^

run_prepare_commit_msg()

Code to execute as part of the prepare-commit-msg hook.

  my $success = App::GitHooks::Plugin::PrependTicketID->run_prepare_commit_msg();

BUGS ^

Please report any bugs or feature requests through the web interface at https://github.com/guillaumeaubert/App-GitHooks-Plugin-PrependTicketID/issues/new. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

        perldoc App::GitHooks::Plugin::PrependTicketID

You can also look for information at:

AUTHOR ^

Guillaume Aubert, <aubertg at cpan.org>.

COPYRIGHT & LICENSE ^

Copyright 2013-2014 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/

syntax highlighting: