Reputation: 590
I am setting up Gitolite server with strict restrictions. Gitolite doc is good but I think I still need some suggestion if what I am doing is good approach.
Users should have access to only master branch. They cannot cannot create any branch or tag. Also I'll like to prevent force push. Only thing user can do is do simple commit.
I am not if sure this will do
repo foo
RW+ = @sync
RW master = user
Need to fire trigger or something to notify service of the change and keep db in sync.
What would be better way to get diff after commit. I need to sync all commits in DB. One way I can think of is clone repo to tmp dir using a user like @sync and run git diff. Is there better way to accomplish this?
Upvotes: 1
Views: 56
Reputation: 1323183
You can add your own update hooks, or, in your case, a post-receive hook
add this line in the
rc
file, within the%RC
block, if it's not already present, or uncomment it if it's already present and commented out:
LOCAL_CODE => "$ENV{HOME}/local",
put your hooks into that directory, in a sub-sub-directory called "hooks/common":
Such an hook (post-receive) can do a git diff in it: see this example
git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
The point is: no need to clone the repo: the hook will be executed after each push.
Upvotes: 1