GitBot

From Git SCM Wiki
Jump to: navigation, search

GitBot is the bot used in the #git IRC channel on freenode. It's source is also kept in Git and can be found on GitHub.

GitBot is maintained by Pieter de Bie. You can email Pieter at frimmirf@gmail.com. Questions can also be directed to 'Pieter' on freenode.

Goal

GitBot allows you to scan Git repositories for objects mentioned in an IRC channel. This is useful for referring to a specific commit or file, which can then be viewed online using the link GitBot provides. Currently, only Gitweb and local repositories are supported. As soon as GitHub has a suitable API, support for GitHub will also be added.

Usage

Ref lookup

GitBot works by through a list of provided Git repositories. It can scan this list every time an object is mentioned.

GitBot can be invoked implicitly by supplying a sha1 of an object, at least 7 characters long. If GitBot finds such a phrase, it tries to look up the object on all the supplied Git repositories. If it find one, it creates a tinyurl and returns this in the IRC channel:

23:57 < Pieter> Hey, look how interesting 65c35b2256ecbfaebcf04559fe6070807646afff is!
23:57 < Gitbot> [git 65c35b225]: http://tinyurl.com/6mxgqg -- t7001: fix "git mv" test

GitBot can also be invoked explicitly. The syntax is the following:

    <[Repo] Ref[:Path]>

Where Repo and Ref are optional. This means that you can refer to the `master` branch by using <master> in the IRC channel:

23:55 < Pieter> <master>
23:55 < Gitbot> [git master]: http://tinyurl.com/68cfzf -- Git.pm: Make File::Spec and File::Temp 
                requirement lazy

Similarly, <HEAD:Documentation/githooks.txt> will supply a link to the newest githooks.txt file.

Using the Repo part, you can specify which repository to look in. This only works for repositories added to the list of repositories to look for in that specific channel. For example, you can look up the `README` of Egit:

00:04 < Pieter> <HEAD:README>
00:04 < Gitbot> [git README]: http://tinyurl.com/3pcuxm [blob]
00:04 < Pieter> <egit HEAD:README>
00:04 < Gitbot> [egit README]: http://tinyurl.com/6jenea [blob]

In #git, currently only the git.git and egit.git are on the list. You can also use URL-like strings to specify repositories that are not in the supplied repository list, for example:

23:41 < Pieter> <repo:glibc.git HEAD:README>
23:41 < Gitbot> [glibc README]: http://tinyurl.com/6e536k [blob]

will look up the README on the main branch in the `glibc.git` repository on [1]

Man pages

GitBot also allows you to lookup manpages for git. It does this by responding to any text along the lines of 'man git-log':

14:20 < Pieter> read the man git-log!
14:20 < Gitbot> Pieter: [git-log]: http://tinyurl.com/5pdrmq

GitFaq pages

It is also possible to let GitBot give links to FAQ entries on the GitFaq page:

22:30 < Pieter> John: see faq push-f
22:30 < Gitbot> John: If you use push -f, others might get into problem 
                when pulling. See http://git.or.cz/gitwiki/GitFaq#push-f

This works by adding a macro on the faq page. For example, the push-f macro above was created by adding :

{{Gitlink|push-f|If you use push -f, others might get into when pulling}}

To the FAQ page at the right place. This means that everybody is able (and invited) to add or change FAQ replies by the bot.


Personal tools