Modify

Opened 13 years ago

Closed 13 years ago

Last modified 10 years ago

#8737 closed enhancement (worksforme)

Support git in the hook script

Reported by: Don Marti Owned by: Russ Tyndall
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 Don Marti 13 years ago.
"post-receive" hook to use Trac from git

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by Don Marti

Attachment: trac-post-receive added

"post-receive" hook to use Trac from git

comment:1 Changed 13 years ago by Russ Tyndall

Resolution: worksforme
Status: newclosed

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 13 years ago by Don Marti

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 13 years ago by Russ Tyndall

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.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Russ Tyndall.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.