Gustavo Leite de Mendonça Chaves > Git-Hooks > Git::Hooks::GerritChangeId

Download:
Git-Hooks-0.049.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.049   Source  

NAME ^

Git::Hooks::GerritChangeId - Git::Hooks plugin to insert a Change-Id in a commit message.

VERSION ^

version 0.049

DESCRIPTION ^

This Git::Hooks plugin hooks itself to the commit-msg hook. It is a reimplementation of Gerrit's official commit-msg hook for inserting change-ids in git commit messages. It's does not produce the same Change-Id for the same message, but this is not really necessary, since it keeps existing Change-Id footers unmodified.

(What follows is a partial copy of that document's DESCRIPTION section.)

This plugin automatically inserts a globally unique Change-Id tag in the footer of a commit message. When present, Gerrit uses this tag to track commits across cherry-picks and rebases.

After the hook has been installed in the user's local Git repository for a project, the hook will modify a commit message such as:

    Improve foo widget by attaching a bar.
    
    We want a bar, because it improves the foo by providing more
    wizbangery to the dowhatimeanery.
    
    Signed-off-by: A. U. Thor <author@example.com>

by inserting a new Change-Id: line in the footer:

    Improve foo widget by attaching a bar.
    
    We want a bar, because it improves the foo by providing more
    wizbangery to the dowhatimeanery.
    
    Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
    Signed-off-by: A. U. Thor <author@example.com>

The hook implementation is reasonably intelligent at inserting the Change-Id line before any Signed-off-by or Acked-by lines placed at the end of the commit message by the author, but if no such lines are present then it will just insert a blank line, and add the Change-Id at the bottom of the message.

If a Change-Id line is already present in the message footer, the script will do nothing, leaving the existing Change-Id unmodified. This permits amending an existing commit, or allows the user to insert the Change-Id manually after copying it from an existing change viewed on the web.

To enable the plugin you should add it to the githooks.plugin configuration option:

    git config --add githooks.plugin GerritChangeId

NAME ^

Git::Hooks::GerritChangeId - Git::Hooks plugin to insert a Change-Id in a commit message.

CONFIGURATION ^

There's no configuration needed or provided.

EXPORTS ^

This module exports one routine that can be used directly without using all of Git::Hooks infrastructure.

rewrite_message GIT, MSGFILE

This is the routine used to implement the commit-msg hook. It needs a Git::More object and the name of a file containing the commit message.

REFERENCES ^

Gerrit's Home Page.

Gerrit's official commit-msg hook.

Gerrit's official hook documentation.

AUTHOR ^

Gustavo L. de M. Chaves <gnustavo@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by CPqD <www.cpqd.com.br>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: