Edgewall Software

Changes between Version 30 and Version 31 of TracRepositoryAdmin


Ignore:
Timestamp:
Jul 26, 2013, 9:44:00 PM (7 years ago)
Author:
dkg@…
Comment:

improve the git examples; old examples only created a change event for the most recent changeset

Legend:

Unmodified
Added
Removed
Modified
  • TracRepositoryAdmin

    v30 v31  
    140140==== Git ====
    141141
    142 Git hooks can be used in the same way for explicit syncing of Git repositories. Add the following to `.git/hooks/post-commit`:
    143 {{{#!sh
    144 #!/bin/sh
    145 REV=$(git rev-parse HEAD)
    146 trac-admin /path/to/env changeset added <repos> $REV
     142Git hooks can be used in the same way for explicit syncing of Git repositories.  If your git repository is one that gets committed to directly on the machine that hosts trac, add the following to the `hooks/post-receive` file in your git repo (note: this will do nothing if you only update the repo by pushing to it):
     143{{{#!sh
     144#!/bin/sh
     145REV=$(git rev-parse HEAD)
     146trac-admin /path/to/env changeset added <repos> $REV
     147}}}
     148
     149Alternately, if your repository is one that only gets pushed to, add the following to the `hooks/post-receive` file in the repo:
     150{{{#!sh
     151#!/bin/sh
     152while read oldrev newrev refname; do
     153        git rev-list --reverse $newrev ^$oldrev  | \
     154        while read rev; do
     155                trac-admin /path/to/env changeset added <repos> $rev
     156        done
     157done
    147158}}}
    148159