Modify

Opened 4 years ago

Closed 4 years ago

Last modified 9 months ago

#8737 closed enhancement (worksforme)

Support git in the hook script

Reported by: dmarti Owned by: bobbysmith007
Priority: normal Component: TimingAndEstimationPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description

The hook interface for Git is different from Subversion -- in order to make this plugin work with git, I had to make a few changes to the hook script. Attached.

Attachments (1)

trac-post-receive (13.7 KB) - added by dmarti 4 years ago.
"post-receive" hook to use Trac from git

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by dmarti

"post-receive" hook to use Trac from git

comment:1 Changed 4 years ago by bobbysmith007

  • Resolution set to worksforme
  • Status changed from new to closed

the trac_post_commit.py is not inteded to be used as either an svn or git hook directly (at least as we use it). Thats is not to say that what you have done is incorrect or not going to work, just that it wasn't the way it was envisioned or the way we use it in our env.

If you look in the scripts dir, you will see that there are three possible "hook" scripts to accompany this one.

  • svn-post-commit.sh a standard svn post commit hook that calls the trac_post_commit.py
  • git-post-receive a simple git post receive hook that forwards commits on to trac_post_commit.py
  • git_post_receive.py - a much more complex git post receive that ensures each commit is only posted to trac once (rather than once per branch or only for a single branch).

I will note that none of these scripts performs the username munging that the one you posted does.

As such I dont think that this script needs to be merged in / committed. Do you agree? I updated the main wiki page to make some of this more obvious.

Thanks for your feedback, please let me know if you think there is any further action I need to take in regards to the post commit hooks

comment:2 Changed 4 years ago by dmarti

Thanks for the info.

On the server where this is going to be used, we have to be able to parse hours from commit messages (that will come in from git users) as well as hours added in the trac web interface, and make sure that they go to the same user -- so in the reports, hours for git user "joe@…" get added to the hours for Trac user "joe". Is there a way to do this with the existing scripts?

comment:3 Changed 4 years ago by bobbysmith007

No, that is definitely not something the scripts currently do. We have a relatively small number of employees with very direct mappings from git user to trac user (just drop the @whatever) so this has not been a need of ours.

Add Comment

Modify Ticket

Action
as closed The owner will remain bobbysmith007.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.