Changes between Version 4 and Version 5 of TracGit
- Timestamp:
- Jun 9, 2012, 6:26:49 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracGit
v4 v5 1 1 [[PageOutline(2-3)]] 2 = Git Plugin forTrac (#10594) =2 = Git support in Trac (#10594) = 3 3 4 This a plugin for Trac which enables5 [http://git-scm.com/ Git] 6 to be used as theVersionControlSystem for Trac.4 Starting with version [milestone:1.0], Trac features built-in support 5 for [http://git-scm.com/ Git] so that it can be used as one of the 6 VersionControlSystem for Trac. 7 7 8 == Download and Installation == 8 Please note that we're still considering the level of performance to 9 be sub-optimal, so it might not work for you. Small to medium sized 10 repositories should be handled reasonably well, however. 9 11 10 12 == Git == 13 === Download and Installation === 11 14 12 You can download Git itself from15 You need to have the `git` command line tools installed. You can download Git itself from 13 16 [http://git-scm.com/download Git:Download]. 14 17 … … 18 21 === Configuration === 19 22 20 The configuration has to be done on the Trac side, 21 there's nothing to do on the Git repository side, 22 except for the fact that the repository should be made 23 accessible as a local repository. 24 Thanks to the distributed nature of Git, that's 25 always possible (if the repository is not already local, 26 simply `git clone` it). 23 The configuration has to be done mainly on the Trac side, 24 there's nothing required to do on the Git repository side. 25 Some advanced use cases necessitate however to install a 26 `post-receive` hook in the Git repository (see [#hooks below]). 27 27 28 == Trac Git plugin == 28 Note that the repository should be made accessible as a local repository. 29 Thanks to the distributed nature of Git, that's always possible (if the 30 repository is not already local, simply `git clone` it). 29 31 30 The Trac Git plugin is included with Trac (since 0.13) as an optional component. 32 == Trac == 33 34 The Trac Git support is included with Trac since 1.0 as an optional component: `tracopt.versioncontrol.git`. 35 31 36 You simply have to explicitly ''enable'' the plugin in TracIni: 32 37 {{{ … … 35 40 }}} 36 41 42 The web administration interface can also be used for this, 43 using the //General / Plugins// panel. 44 37 45 === Setting up a Trac environment === 38 46 … … 40 48 or create a brand new one. 41 49 50 ==== New environment 42 51 For general instructions, see TracInstall. 43 52 … … 45 54 - for the ''repository type'', specify `git` instead of the default `svn`. 46 55 - for the ''repository directory'', specify the location of the Git repository 47 (including the ending `.git` ).56 (including the ending `.git` directory). 48 57 49 58 Your [wiki:TracIni <trac_environment>/conf/trac.ini] configuration file … … 55 64 }}} 56 65 57 There's also a few Git specific settings in TracIni: 58 {{{ 59 [git] 60 ## let Trac cache meta-data via CachedRepository wrapper; default: false 61 cached_repository = true 66 ==== Adding a Git repository to an existing environment 62 67 63 ## disable automatic garbage collection for in-memory commit-tree cache; default: false 64 persistent_cache = true 68 If all you need is to work with a single git environment, it is enough 69 to modify the `[trac]` section in your [TracIni trac.ini] so that it 70 contains the appropriate values for the `repository_type` and 71 `repository_dir` options, like in the above example. 65 72 66 ## length revision sha-sums should be tried to be abbreviated to (must be >= 4 and <= 40); default: 7 67 shortrev_len = 6 73 However, if you need more than one git repository, or I you want to 74 keep your old Subversion repository as the default repository in order 75 to not break the TracLinks pointing to source files and changesets 76 contained in that repository, you can add non-default repositories. 68 77 69 ## minimum length for which hex-strings will be interpreted as commit ids in wiki context; default: 40 70 wiki_shortrev_len = 7 78 There is basically two ways to do it, either via the 79 [TracIni#repositories-section "[repositories]"] section of the TracIni 80 file, or via the web administration interface using the 81 //Version Control / Repositories// panel. 82 For more details, see the TracRepositoryAdmin. 71 83 72 ## executable file name (in case of doubt use absolute path!) of git binary; default: 'git' 73 git_bin = /usr/src/git-dev/git 84 ==== Fine tune `trac.ini` settings 74 85 75 ## define charset encoding of paths stored within git repository; default: 'utf-8' 76 git_fs_encoding = latin1 86 There are a few Git specific settings that can be specified in [wiki:0.13/TracIni#git-section "TracIni [git]"] section. 77 87 78 ## enable reverse mapping of git email addresses to trac user ids; default: false79 trac_user_rlookup = true80 88 81 ## use git-committer id instead of git-author id as changeset owner; default: true 82 use_committer_id = false 89 === Setting up post-receive hooks === #hooks 83 90 84 ## use git-committer timestamp instead of git-author timestamp as changeset time; default: true 85 use_committer_time = false 86 }}} 91 If you want to benefit from some advanced features for your repository, 92 like automatically update your tickets based on the content of the commit 93 messages (CommitTicketUpdater) or smart caching, then you need to create 94 or modify the [http://git-scm.com/book/en/Customizing-Git-Git-Hooks#Server-Side-Hooks post-receive] hook in the `.git/hooks` 95 repository so that it calls `trac-admin repository` appropriately. 87 96 88 === Setting up post-receive hooks === 89 If you want to enable post-receive hook functionality on your repository, put a post-receive script into `your_repository.git/hooks/`. 97 enable post-receive hook functionality on your repository, put a post-receive script into `your_repository.git/hooks/`. 90 98 91 99 TODO: Include post-receive scripts attached to http://trac-hacks.org/wiki/GitPlugin#post-receivehookscripts 92 100 93 You must also enable the CommitTicketUpdater functionality in your `trac.ini` by adding101 You can then enable the CommitTicketUpdater functionality in your `trac.ini` by adding: 94 102 95 103 {{{ … … 115 123 * `repository_dir` in the configuration section needs to be the `.git` repository directory (i.e. the one containing the file `HEAD` and `config`), not the working tree directory that holds the `.git/` folder. 116 124 * Wrong permissions may also be the cause of the error `GitError: GIT control files not found, maybe wrong directory?`. Make sure the `repository_dir` argument is accessible via git by the `tracd` process. 117 * If you are noticing a slow down in trac with a repository above 500 commits, try disabling the caching. It seems to bog things down as a repo grows .125 * If you are noticing a slow down in trac with a repository above 500 commits, try disabling the caching. It seems to bog things down as a repo grows(!) 118 126 * Don't forget to enable the plugin: 119 {{{120 121 122 }}}127 {{{ 128 [components] 129 tracopt.versioncontrol.git.* = enabled 130 }}} 123 131 * If you don't see the `shortrev` and `commit` branch, you probably have caching enabled (`cached_repository = true, persistent_cache = true`). Set those to false. 124 132 … … 129 137 == History 130 138 131 The plugin was developed by Herbert Valerio Riedel for Trac 0.10-0.13 at th:GitPlugin / [https://github.com/hvr/trac-git-plugin GitHub]. For Trac 0.13 it has now been included as a bundled optional plugin, and is maintained and developed here139 The Git support was initially developed as a plugin by Herbert Valerio Riedel for Trac 0.10-0.13. See TracHacks:GitPlugin / [https://github.com/hvr/trac-git-plugin GitHub]. For Trac 1.0, it has now been included as an optional component, and is maintained and developed here.