git-http-push and hooks
Hi,
Just a silly question :
Why aren't excute hooks/* (with +x perms) when I do a git-http-push ? Also if i push with cg-push on the same repo but with git+ssh protocol, hooks are execute.
Thanks
Signature · 3 lines
/* Beber : beber (AT) setibzh (DOT) com
* http://guybrush.ath.cx, irc://irc.freenode.net/#{e.fr,gentoofr}
* Guybrush @ Melee */Quoted 3 lines · Bertrand Jacquin (Beber)
Why aren't excute hooks/* (with +x perms) when I do a git-http-push ? Also if i push with cg-push on the same repo but with git+ssh protocol, hooks are execute.
Hooks must run on the destination server when you're doing a push. If you use the git+ssh protocol, that server is running a git daemon that knows how to execute hooks; if you use the http/DAV protocol, that server does not.
Signature · 2 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled.
Quoted 11 lines · Nick Hengeveld
Quoted 3 lines · Bertrand Jacquin (Beber)
Why aren't excute hooks/* (with +x perms) when I do a git-http-push ? Also if i push with cg-push on the same repo but with git+ssh protocol, hooks are execute.
Hooks must run on the destination server when you're doing a push. If you use the git+ssh protocol, that server is running a git daemon that knows how to execute hooks; if you use the http/DAV protocol, that server does not.
I know basically nothing about DAV, but wouldn't it be possible to have a CGI-script which executes the hooks upon the client's request?
- Fredrik
Quoted 2 lines · Fredrik Kuivinen
I know basically nothing about DAV, but wouldn't it be possible to have a CGI-script which executes the hooks upon the client's request?
It would, although if custom software can be run on the server you might as well run the git daemon.
There are options for a DAV-only environment though. While the hooks themselves can't be run, git-http-push can be modified to update the remote pack and ref info (although it's not clear to me under what conditions it should do so...) DAV-specific versions of pack management utilities are feasible as well.
Signature · 2 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled.
Quoted 7 lines · Nick Hengeveld
Quoted 2 lines · Fredrik Kuivinen
I know basically nothing about DAV, but wouldn't it be possible to have a CGI-script which executes the hooks upon the client's request?
It would, although if custom software can be run on the server you might as well run the git daemon.
You can't push to a git daemon, can you?
Furthermore, if the user has a working http/DAV server installed it might be the case that she prefers to use that one instead of installing a new daemon.
- Fredrik
Quoted 6 lines · Fredrik Kuivinen
Quoted 5 lines · Nick Hengeveld
Quoted 2 lines · Fredrik Kuivinen
I know basically nothing about DAV, but wouldn't it be possible to have a CGI-script which executes the hooks upon the client's request?
Quoted 8 lines
Quoted 2 lines
It would, although if custom software can be run on the server you might as well run the git daemon.
You can't push to a git daemon, can you?
Furthermore, if the user has a working http/DAV server installed it might be the case that she prefers to use that one instead of installing a new daemon.
Personaly is use http because at work i've a $$@#! proxy and allow dav and nothing else.
Could you push over http/proxy with gitdaemon ? Isn't it just a read only method ?
Quoted 7 lines
- Fredrik
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Beber
#e.fr@freenode
Quoted 11 lines · Bertrand Jacquin
Quoted 5 lines · Fredrik Kuivinen
You can't push to a git daemon, can you?
Furthermore, if the user has a working http/DAV server installed it might be the case that she prefers to use that one instead of installing a new daemon.
Personaly is use http because at work i've a $$@#! proxy and allow dav and nothing else.
Could you push over http/proxy with gitdaemon ? Isn't it just a read only method ?
I think you are agreeing with what Fredrik said. git-daemon is a read-only thing. You would want to SSH into the repository machine.
If you are using git at work for work, and the benefit git gives you outweigh the cost and trouble to modify the proxy and/or firewalling settings, maybe you can convince your management to allow you to SSH out to make you more productive? That way you can use git-push over native git protocol.
If you are using git while at work but not for work, then maybe I should not be giving an advice ;-).
Quoted 5 lines · Nick Hengeveld
There are options for a DAV-only environment though. While the hooks themselves can't be run, git-http-push can be modified to update the remote pack and ref info (although it's not clear to me under what conditions it should do so...) DAV-specific versions of pack management utilities are feasible as well.
If the server info updates is the _only_ problem, then perhaps that would be the easiest and cleanest. Whenever you update or add a ref you would need to update info/refs (otherwise ls-remote would not give you the latest info), and whenever you repack you would need to update objects/info/packs.
You may probably want to have a CGI to allow you manage the repository remotely anyway, to trigger a repack or remove a stale branch head, for example. Once you go that route maybe having the CGI to do something like the pack protocol for more efficient transfer might become more attractive.
Quoted 5 lines · Junio C Hamano
If the server info updates is the _only_ problem, then perhaps that would be the easiest and cleanest. Whenever you update or add a ref you would need to update info/refs (otherwise ls-remote would not give you the latest info), and whenever you repack you would need to update objects/info/packs.
What happens if someone else updates a ref and it no longer matches your local ref? Should the push scan the remote versions of all local refs and update whatever doesn't match?
Quoted 5 lines
You may probably want to have a CGI to allow you manage the repository remotely anyway, to trigger a repack or remove a stale branch head, for example. Once you go that route maybe having the CGI to do something like the pack protocol for more efficient transfer might become more attractive.
That's an option if the user has the ability to install CGI scripts on the DAV server, which doesn't seem like it will always be true. Perhaps it would make sense to do both:
- add a git-http-repack command that works in a DAV-only environment
- add a CGI script to provide remote management, and a config setting to git-http-push for the remote management URL
Signature · 2 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled.
Quoted 3 lines · Nick Hengeveld
What happens if someone else updates a ref and it no longer matches your local ref? Should the push scan the remote versions of all local refs and update whatever doesn't match?
If I and you clone from a shared repository at the same time, I did my development while you did your own on top of that same commit without pulling from the repository further, and I uploaded my changes to update the ref, what should happen to you once you are ready to push?
Is that what being asked?
If so, I think the sensible thing to do is to reject your push and suggest you to pull first, just like the git native protocol push does. That pull would end up first merging my changes to your work in your repository, and then you can push the result back to the shared repository. Otherwise you would lose my changes.
The criteria to allow a push is obviously not "no longer matches" because in the above scenario what both you and I fetched from the shared repository is something that is an ancestor of what each of us is trying to push. The first one should succeed -- it is pushing a new commit that is a descendant of what is currently the head of the shared repository. The latter one fails because at that time the head of the shared repository is not an ancestor of what you are trying to push.
If you are asking about a race, yes there is a race condition and you have to be careful. The native protocol does it like so (receive-pack.c):
1. At the shared repository grab the current head;
2. Examine what is being pushed. Is it a descendant of the one we grabbed in the previous step? If not, reject.
3. Lock the ref, grab the current head again, make sure it is still the same as what we got in the first step, update it with what was pushed, and then unlock.
I think you may be able to do a similar check on the client side, if DAV allows locking resources at least for a brief period.
If you are asking about updating local tracking branch for the remote ref after a successful push, I think that is an optional feature and is entirely up to you. For example, if your workflow is to fetch from the shared repository into origin, merge that into master, work on master, and then push the result to the master branch of the shared repository, you could update your origin with the commit you just pushed. This lets you pretend as if you fetched from there immediately after your successful push.
I think Cogito does it that way, but I personally found leaving the tracing ref as-is after a push more useful, so I left git-push not to do so. For example, leaving when to update "origin" up to me allows me do run "git log origin..master" to write the "what's new in git.git" message after I push. Of course the same thing can be done by running the git log before I push, so there is not much practical difference either way.
Quoted 6 lines · Junio C Hamano
If I and you clone from a shared repository at the same time, I did my development while you did your own on top of that same commit without pulling from the repository further, and I uploaded my changes to update the ref, what should happen to you once you are ready to push?
Quoted 8 lines
Is that what being asked?
If so, I think the sensible thing to do is to reject your push and suggest you to pull first, just like the git native protocol push does. That pull would end up first merging my changes to your work in your repository, and then you can push the result back to the shared repository. Otherwise you would lose my changes.
Makes sense, and it's the way http-push already works for heads. I guess where I'm not clear is tags - since info/refs is generated by recursing through everything in the refs/ subdirectory. I think I just answered my own question though; http-push needs to recurse through everything under refs/ on the remote end to generate the new info/refs file. That just leaves the problem that http-push doesn't push tags yet.
Signature · 2 lines
For a successful technology, reality must take precedence over public relations, for nature cannot be fooled.
Quoted 7 lines · Fredrik Kuivinen
Quoted 6 lines · Nick Hengeveld
Quoted 3 lines · Bertrand Jacquin (Beber)
Why aren't excute hooks/* (with +x perms) when I do a git-http-push ? Also if i push with cg-push on the same repo but with git+ssh protocol, hooks are execute.
Quoted 8 lines
Quoted 5 lines
Hooks must run on the destination server when you're doing a push. If you use the git+ssh protocol, that server is running a git daemon that knows how to execute hooks; if you use the http/DAV protocol, that server does not.
I know basically nothing about DAV, but wouldn't it be possible to have a CGI-script which executes the hooks upon the client's request?
Svn can execute hooks :/ But maybe this is implemented in -D SVN module for Apache. Donno
Quoted 7 lines
- Fredrik
-
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Beber
#e.fr@freenode