Documentation / git-cvsserver.txton commit user-manual: use pithier example commit (e2618ff)
   1git-cvsserver(1)
   2================
   3
   4NAME
   5----
   6git-cvsserver - A CVS server emulator for git
   7
   8SYNOPSIS
   9--------
  10[verse]
  11export CVS_SERVER=git-cvsserver
  12'cvs' -d :ext:user@server/path/repo.git co <HEAD_name>
  13
  14DESCRIPTION
  15-----------
  16
  17This application is a CVS emulation layer for git.
  18
  19It is highly functional. However, not all methods are implemented,
  20and for those methods that are implemented,
  21not all switches are implemented.
  22
  23Testing has been done using both the CLI CVS client, and the Eclipse CVS
  24plugin. Most functionality works fine with both of these clients.
  25
  26LIMITATIONS
  27-----------
  28
  29Currently cvsserver works over SSH connections for read/write clients, and
  30over pserver for anonymous CVS access.
  31
  32CVS clients cannot tag, branch or perform GIT merges.
  33
  34git-cvsserver maps GIT branches to CVS modules. This is very different
  35from what most CVS users would expect since in CVS modules usually represent
  36one or more directories.
  37
  38INSTALLATION
  39------------
  40
  411. If you are going to offer anonymous CVS access via pserver, add a line in
  42   /etc/inetd.conf like
  43+
  44--
  45------
  46   cvspserver stream tcp nowait nobody git-cvsserver pserver
  47
  48------
  49Note: Some inetd servers let you specify the name of the executable
  50independently of the value of argv[0] (i.e. the name the program assumes
  51it was executed with). In this case the correct line in /etc/inetd.conf
  52looks like
  53
  54------
  55   cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
  56
  57------
  58No special setup is needed for SSH access, other than having GIT tools
  59in the PATH. If you have clients that do not accept the CVS_SERVER
  60environment variable, you can rename git-cvsserver to cvs.
  61
  62Note: Newer cvs versions (>= 1.12.11) also support specifying
  63CVS_SERVER directly in CVSROOT like
  64
  65------
  66cvs -d ":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git" co <HEAD_name>
  67------
  68This has the advantage that it will be saved in your 'CVS/Root' files and
  69you don't need to worry about always setting the correct environment
  70variable.
  71--
  722. For each repo that you want accessible from CVS you need to edit config in
  73   the repo and add the following section.
  74+
  75--
  76------
  77   [gitcvs]
  78        enabled=1
  79        # optional for debugging
  80        logfile=/path/to/logfile
  81
  82------
  83Note: you need to ensure each user that is going to invoke git-cvsserver has
  84write access to the log file and to the database (see
  85<<dbbackend,Database Backend>>. If you want to offer write access over
  86SSH, the users of course also need write access to the git repository itself.
  87
  88[[configaccessmethod]]
  89All configuration variables can also be overridden for a specific method of
  90access. Valid method names are "ext" (for SSH access) and "pserver". The
  91following example configuration would disable pserver access while still
  92allowing access over SSH.
  93------
  94   [gitcvs]
  95        enabled=0
  96
  97   [gitcvs "ext"]
  98        enabled=1
  99------
 100--
 1013. On the client machine you need to set the following variables.
 102   CVSROOT should be set as per normal, but the directory should point at the
 103   appropriate git repo. For example:
 104+
 105--
 106For SSH access, CVS_SERVER should be set to git-cvsserver
 107
 108Example:
 109
 110------
 111     export CVSROOT=:ext:user@server:/var/git/project.git
 112     export CVS_SERVER=git-cvsserver
 113------
 114--
 1154. For SSH clients that will make commits, make sure their .bashrc file
 116   sets the GIT_AUTHOR and GIT_COMMITTER variables.
 117
 1185. Clients should now be able to check out the project. Use the CVS 'module'
 119   name to indicate what GIT 'head' you want to check out. Example:
 120+
 121------
 122     cvs co -d project-master master
 123------
 124
 125[[dbbackend]]
 126Database Backend
 127----------------
 128
 129git-cvsserver uses one database per git head (i.e. CVS module) to
 130store information about the repository for faster access. The
 131database doesn't contain any persistent data and can be completely
 132regenerated from the git repository at any time. The database
 133needs to be updated (i.e. written to) after every commit.
 134
 135If the commit is done directly by using git (as opposed to
 136using git-cvsserver) the update will need to happen on the
 137next repository access by git-cvsserver, independent of
 138access method and requested operation.
 139
 140That means that even if you offer only read access (e.g. by using
 141the pserver method), git-cvsserver should have write access to
 142the database to work reliably (otherwise you need to make sure
 143that the database if up-to-date all the time git-cvsserver is run).
 144
 145By default it uses SQLite databases in the git directory, named
 146`gitcvs.<module_name>.sqlite`. Note that the SQLite backend creates
 147temporary files in the same directory as the database file on
 148write so it might not be enough to grant the users using
 149git-cvsserver write access to the database file without granting
 150them write access to the directory, too.
 151
 152You can configure the database backend with the following
 153configuration variables:
 154
 155Configuring database backend
 156~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 157
 158git-cvsserver uses the Perl DBI module. Please also read
 159its documentation if changing these variables, especially
 160about `DBI->connect()`.
 161
 162gitcvs.dbname::
 163        Database name. The exact meaning depends on the
 164        used database driver, for SQLite this is a filename.
 165        Supports variable substitution (see below). May
 166        not contain semicolons (`;`).
 167        Default: '%Ggitcvs.%m.sqlite'
 168
 169gitcvs.dbdriver::
 170        Used DBI driver. You can specify any available driver
 171        for this here, but it might not work. cvsserver is tested
 172        with 'DBD::SQLite', reported to work with
 173        'DBD::Pg', and reported *not* to work with 'DBD::mysql'.
 174        Please regard this as an experimental feature. May not
 175        contain double colons (`:`).
 176        Default: 'SQLite'
 177
 178gitcvs.dbuser::
 179        Database user. Only useful if setting `dbdriver`, since
 180        SQLite has no concept of database users. Supports variable
 181        substitution (see below).
 182
 183gitcvs.dbpass::
 184        Database password.  Only useful if setting `dbdriver`, since
 185        SQLite has no concept of database passwords.
 186
 187All variables can also be set per access method, see <<configaccessmethod,above>>.
 188
 189Variable substitution
 190^^^^^^^^^^^^^^^^^^^^^
 191In `dbdriver` and `dbuser` you can use the following variables:
 192
 193%G::
 194        git directory name
 195%g::
 196        git directory name, where all characters except for
 197        alpha-numeric ones, `.`, and `-` are replaced with
 198        `_` (this should make it easier to use the directory
 199        name in a filename if wanted)
 200%m::
 201        CVS module/git head name
 202%a::
 203        access method (one of "ext" or "pserver")
 204%u::
 205        Name of the user running git-cvsserver.
 206        If no name can be determined, the
 207        numeric uid is used.
 208
 209Eclipse CVS Client Notes
 210------------------------
 211
 212To get a checkout with the Eclipse CVS client:
 213
 2141. Select "Create a new project -> From CVS checkout"
 2152. Create a new location. See the notes below for details on how to choose the
 216   right protocol.
 2173. Browse the 'modules' available. It will give you a list of the heads in
 218   the repository. You will not be able to browse the tree from there. Only
 219   the heads.
 2204. Pick 'HEAD' when it asks what branch/tag to check out. Untick the
 221   "launch commit wizard" to avoid committing the .project file.
 222
 223Protocol notes: If you are using anonymous access via pserver, just select that.
 224Those using SSH access should choose the 'ext' protocol, and configure 'ext'
 225access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to
 226'git-cvsserver'. Note that password support is not good when using 'ext',
 227you will definitely want to have SSH keys setup.
 228
 229Alternatively, you can just use the non-standard extssh protocol that Eclipse
 230offer. In that case CVS_SERVER is ignored, and you will have to replace
 231the cvs utility on the server with git-cvsserver or manipulate your `.bashrc`
 232so that calling 'cvs' effectively calls git-cvsserver.
 233
 234Clients known to work
 235---------------------
 236
 237- CVS 1.12.9 on Debian
 238- CVS 1.11.17 on MacOSX (from Fink package)
 239- Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
 240- TortoiseCVS
 241
 242Operations supported
 243--------------------
 244
 245All the operations required for normal use are supported, including
 246checkout, diff, status, update, log, add, remove, commit.
 247Legacy monitoring operations are not supported (edit, watch and related).
 248Exports and tagging (tags and branches) are not supported at this stage.
 249
 250The server should set the '-k' mode to binary when relevant, however,
 251this is not really implemented yet. For now, you can force the server
 252to set '-kb' for all files by setting the `gitcvs.allbinary` config
 253variable. In proper GIT tradition, the contents of the files are
 254always respected. No keyword expansion or newline munging is supported.
 255
 256Dependencies
 257------------
 258
 259git-cvsserver depends on DBD::SQLite.
 260
 261Copyright and Authors
 262---------------------
 263
 264This program is copyright The Open University UK - 2006.
 265
 266Authors:
 267
 268- Martyn Smith    <martyn@catalyst.net.nz>
 269- Martin Langhoff <martin@catalyst.net.nz>
 270
 271with ideas and patches from participants of the git-list <git@vger.kernel.org>.
 272
 273Documentation
 274--------------
 275Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@catalyst.net.nz>, and Matthias Urlichs <smurf@smurf.noris.de>.
 276
 277GIT
 278---
 279Part of the gitlink:git[7] suite