在 2017年8月10日星期四 UTC+8下午5:30:07,RjOllos写道: > > > > On Wednesday, August 9, 2017 at 11:23:02 PM UTC-7, Mingxing Tian wrote: >> >> >> >> 在 2017年8月10日星期四 UTC+8上午10:49:15,RjOllos写道: >>> >>> >>> >>> On Wednesday, August 9, 2017 at 7:09:10 PM UTC-7, Mingxing Tian wrote: >>>> >>>> >>>> >>>> 在 2017年8月10日星期四 UTC+8上午4:34:02,RjOllos写道: >>>>> >>>>> >>>>> >>>>> On Tuesday, August 8, 2017 at 7:13:13 PM UTC-7, Mingxing Tian wrote: >>>>>> >>>>>> I follow the following document configuration each time you push to >>>>>> the Git repository, insert a change record to the corresponding task >>>>>> order. >>>>>> >>>>>> http://trac.idouzi.com/wiki/TracRepositoryAdmin#Git >>>>>> >>>>>> In my warehouse hooks do not see the "hooks/post-commit" file, only >>>>>> the following files. >>>>>> >>>>>> [root@host105 hooks]# pwd >>>>>> /home/git/repositories/testing.git/hooks >>>>>> [root@host105 hooks]# ll >>>>>> 总用量 44 >>>>>> -rwx------ 1 git git 478 8月 2 11:47 applypatch-msg.sample >>>>>> -rwx------ 1 git git 896 8月 2 11:47 commit-msg.sample >>>>>> -rwx------ 1 git git 189 8月 9 10:04 post-update.sample >>>>>> -rwx------ 1 git git 424 8月 2 11:47 pre-applypatch.sample >>>>>> -rwx------ 1 git git 1642 8月 2 11:47 pre-commit.sample >>>>>> -rwx------ 1 git git 1239 8月 2 11:47 prepare-commit-msg.sample >>>>>> -rwx------ 1 git git 1348 8月 2 11:47 pre-push.sample >>>>>> -rwx------ 1 git git 4951 8月 2 11:47 pre-rebase.sample >>>>>> -rwx------ 1 git git 544 8月 9 10:02 pre-receive.sample >>>>>> lrwxrwxrwx 1 git git 39 8月 2 11:47 update -> >>>>>> /home/git/.gitolite/hooks/common/update >>>>>> -rwx------ 1 git git 3610 8月 2 11:47 update.sample >>>>>> [root@host105 hooks]# >>>>>> >>>>>> >>>>> You'll probably want to use a post-receive hook, as described in: >>>>> https://trac.edgewall.org/wiki/TracRepositoryAdmin#Git >>>>> >>>>> I don't know why the hooks aren't present your repository, but they >>>>> are documented: >>>>> https://git-scm.com/docs/githooks#post-receive >>>>> >>>>> Maybe the difference has to do with your use of Gitolite? >>>>> >>>>> $git --version >>>>> git version 2.13.3 >>>>> $git init --bare testing.git >>>>> Initialized empty Git repository in ~/testing.git/ >>>>> $ls -l testing.git/hooks/ >>>>> total 88 >>>>> -rwxr-xr-x 1 rjollos staff 478 Aug 9 13:33 applypatch-msg.sample >>>>> -rwxr-xr-x 1 rjollos staff 896 Aug 9 13:33 commit-msg.sample >>>>> -rwxr-xr-x 1 rjollos staff 189 Aug 9 13:33 post-update.sample >>>>> -rwxr-xr-x 1 rjollos staff 424 Aug 9 13:33 pre-applypatch.sample >>>>> -rwxr-xr-x 1 rjollos staff 1642 Aug 9 13:33 pre-commit.sample >>>>> -rwxr-xr-x 1 rjollos staff 1348 Aug 9 13:33 pre-push.sample >>>>> -rwxr-xr-x 1 rjollos staff 4951 Aug 9 13:33 pre-rebase.sample >>>>> -rwxr-xr-x 1 rjollos staff 544 Aug 9 13:33 pre-receive.sample >>>>> -rwxr-xr-x 1 rjollos staff 1239 Aug 9 13:33 >>>>> prepare-commit-msg.sample >>>>> -rwxr-xr-x 1 rjollos staff 3610 Aug 9 13:33 update.sample >>>>> >>>>> >>>>> - Ryan >>>>> >>>>> >>>> Sir, I found that you did not list the "post-commit" in the hook, your >>>> structure and I was the same. >>>> >>> >>> As already stated, you want to use post-receive hook, not post-commit. >>> >>> - Ryan >>> >> >> There is no "post-receive" hook, your environment is not, this is the >> same as my situation. But I found "post-update", maybe it could achieve the >> results I wanted. Anyway, your document is up to date. >> > > Just create the file and add the content shown in: > https://trac.edgewall.org/wiki/TracRepositoryAdmin#Git > > #!/bin/sh > tracenv=/path/to/env # change with your Trac environment's path > repos= # change with your repository's name > while read oldrev newrev refname; do > if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then > git rev-list --reverse "$newrev" -- > else > git rev-list --reverse "$newrev" "^$oldrev" -- > fi | xargs trac-admin "$tracenv" changeset added "$repos" > done > > > The file just needs to be named post-receive and be executable by the user > that invokes the hook. > > Git adds sample hooks when creating a repository, but they are just > samples. You can just create the ones that don't exist. > > - Ryan >
I try to create the file "post-receive" and enter the contents of the given, of course, modify the value of the above two lines of variables. But the result is a failure, this way is not correct. This feature works only when I add the following two lines to the "post-update" file. REV=$(git rev-parse HEAD) trac-admin /home/projects/xxx changeset added testing $REV -- You received this message because you are subscribed to the Google Groups "Trac Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscr...@googlegroups.com. To post to this group, send email to trac-users@googlegroups.com. Visit this group at https://groups.google.com/group/trac-users. For more options, visit https://groups.google.com/d/optout.