Code Monkey home page Code Monkey logo

bugtraq's Introduction

Git Bugtraq Configuration specification
=======================================
Version 0.2.2, 2013-10-04


1. Introduction
---------------

Git commits are often related to specific issues (or bugs). The Git
Bugtraq Configuration allows to associate a Git commit with a
corresponding issue ID. Git clients may use this association to provide
additional functionality, like displaying a hyperlink for issue IDs
within a commit message which links to the appropriate issue tracker
web page.

The Git Bugtraq Configuration is similar to Subversion bugtraq
properties[1] and includes concepts of Gerrit commentlinks[2].


2. Configuration options
------------------------

The main configuration namespace is 'bugtraq'. <name> is the
configuration name (see section 3).

* bugtraq.<name>.url (mandatory)

specifies the URL of the bug tracking system. It must be properly URI
encoded and it has to contain %BUGID%. %BUGID% will be replaced by the
Git client with a concrete issue ID.


* bugtraq.<name>.logRegex (mandatory) and
  bugtraq.<name>.logRegex<N> (optional)

specify Perl Compatible Regular Expressions[3] which will be used to
extract the issue ID from a commit message.

logRegex must contain exactly one matching group, which represents the
extracted BUGID. There may be additional non-matching groups ('(?:').
logRegex matches case-sensitive unless explicitly set to case-
insensitive ('(?i)').

If there are optional logRegex1, logRegex2, ... present, the extracted
results of logRegex is used as input for logRegex1, the result of
logRegex1 is used as input of logRegex2 and so on. logRegex1 ...
logRegexN must be consecutively numbered and will be applied in
numbering order. If any of logRegex ... logRegexN do not match, no
BUGID will be extracted.

Example: with logRegex set to

  [Ii]ssues?:?(\s*(,|and)?\s*#\d+)+

and logRegex1 set to

  (\d+)

and having a commit message like

  Issues #3, #4 and #5: Git Bugtraq Configuration options (see #12)

logRegex will pick "Issues #3, #4 and #5" and logRegex1 will pick "3", "
4" and "5".

Note: in Git-Config-like files, backslashes needs to be escaped (see
section 5).

* bugtraq.<name>.enabled (optional)

specifies whether this Bugtraq Configuration is enabled. It defaults to
'true'.


3. Multiple configurations
--------------------------

There can be multiple configurations, either to support multiple issue
trackers or alternative configurations for the same issue tracker. In
the latter case, probably only one of these configurations will be
enabled.

Every configuration uses its own namespace 'bugtraq.<name>'.
Configurations will be processed in order of appearance in the
configuration files (section 4).

When extracting issue IDs from a commit message, the client will
stop processing further configurations once logRegex of the currently
processed configuration matches, regardless whether logRegexN actually
match or not, i.e. regardless whether there will be actually a BUGID
extracted or not.


4. Configuration files
----------------------

There are two places where the configuration options can be specified:

* in the .gitbugtraq file in the repository root. This file is using
  the default Git config file layout.

* in $GIT_DIR/config

Options specified in $GIT_DIR/config will override options from
.gitbugtraq.

An example content of .gitbugtraq (note, that '\' need to be escaped):

  [bugtraq "tracker"]
    url = https://host/browse/SG-%BUGID%
    logRegex = \\d+
    logRegex1 = SG-(\\d+)
    
Exactly the same lines could be added as an additional section to
$GIT_DIR/config as well.


5. logRegEx examples
--------------------

* From messages like "Fix: #1" or "fixes:  #1, #2 and #3",
  the "1", "2" and "3" should be extracted.

  logRegex =  "(?i)fix(?:es)?\\: ((\\s*(,|and)?\\s*#\\d+)+)"
  logRegex1 = (\\d+) 

* From messages like "Bug: #1" or "Bug IDs: #1; #2; #3" or
  "Cases: #1, #2" the "1", "2" and "3" should be extracted.

  logRegex = "(?i)(?:Bug[zs]?\\s*IDs?\\s*|Cases?)[#:; ]+((\\d+[ ,:;#]*)+)"
  logRegex1 = \\d+
  

References
----------

[1] http://tortoisesvn.net/docs/release/TortoiseSVN_en/
    tsvn-dug-bugtracker.html

[2] https://gerrit-review.googlesource.com/Documentation/
    config-gerrit.html#_a_id_commentlink_a_section_commentlink

[3] http://perldoc.perl.org/perlre.html

bugtraq's People

Contributors

mstrap avatar srombauts avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.