git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git daemon --access-hook problem
@ 2013-05-31 20:22 Eugene Sajine
  2013-06-03  0:33 ` Eugene Sajine
  2013-06-03 17:20 ` Antoine Pelisse
  0 siblings, 2 replies; 6+ messages in thread
From: Eugene Sajine @ 2013-05-31 20:22 UTC (permalink / raw)
  To: git

Hi,

I'm trying to test this new feature and having problems getting any
results in the following scenario:

i have a repo in local folder

/home/users/myuser/repos/projectA/.git

i start the daemon with the following:

git daemon --export-all --base-path=/home/users/myuser/repos
--enable=receive-pack --access-hook=/home/users/myuser/test_hook.bash

test_hook.bash has the following:

#!/bin/bash
echo $@ >> test_hook_out.txt
echo $REMOTE_ADDR >> test_hook_out.txt

the hook is set to be executable - otherwise it complains when i do
anything via git protocol, which proves that it seems to or check the
hook:

then i did:

cd ~/tmp/

git clone git://myhost/projectA projectA
cd projectA

and trying to perform some operations like fetch or push. It is cloned
and fetches and pushes successfully.
The problem is that the file test_hook_out.txt doesn't have anything
in it after the execution, So the hook doesn't seem to work.

What might be the issue here?

Thanks,
Eugene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git daemon --access-hook problem
  2013-05-31 20:22 git daemon --access-hook problem Eugene Sajine
@ 2013-06-03  0:33 ` Eugene Sajine
  2013-06-03 17:20 ` Antoine Pelisse
  1 sibling, 0 replies; 6+ messages in thread
From: Eugene Sajine @ 2013-06-03  0:33 UTC (permalink / raw)
  To: git

Anybody? Any ideas?

Thanks in advance!

Eugene

On Fri, May 31, 2013 at 4:22 PM, Eugene Sajine <euguess@gmail.com> wrote:
> Hi,
>
> I'm trying to test this new feature and having problems getting any
> results in the following scenario:
>
> i have a repo in local folder
>
> /home/users/myuser/repos/projectA/.git
>
> i start the daemon with the following:
>
> git daemon --export-all --base-path=/home/users/myuser/repos
> --enable=receive-pack --access-hook=/home/users/myuser/test_hook.bash
>
> test_hook.bash has the following:
>
> #!/bin/bash
> echo $@ >> test_hook_out.txt
> echo $REMOTE_ADDR >> test_hook_out.txt
>
> the hook is set to be executable - otherwise it complains when i do
> anything via git protocol, which proves that it seems to or check the
> hook:
>
> then i did:
>
> cd ~/tmp/
>
> git clone git://myhost/projectA projectA
> cd projectA
>
> and trying to perform some operations like fetch or push. It is cloned
> and fetches and pushes successfully.
> The problem is that the file test_hook_out.txt doesn't have anything
> in it after the execution, So the hook doesn't seem to work.
>
> What might be the issue here?
>
> Thanks,
> Eugene

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git daemon --access-hook problem
  2013-05-31 20:22 git daemon --access-hook problem Eugene Sajine
  2013-06-03  0:33 ` Eugene Sajine
@ 2013-06-03 17:20 ` Antoine Pelisse
  2013-06-03 18:02   ` Eugene Sajine
  1 sibling, 1 reply; 6+ messages in thread
From: Antoine Pelisse @ 2013-06-03 17:20 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

On Fri, May 31, 2013 at 10:22 PM, Eugene Sajine <euguess@gmail.com> wrote:
> and trying to perform some operations like fetch or push. It is cloned
> and fetches and pushes successfully.
> The problem is that the file test_hook_out.txt doesn't have anything
> in it after the execution, So the hook doesn't seem to work.
>
> What might be the issue here?

I have no idea what the issue might be, but here's how I usually debug
this kind of situations:
- Exit with a non-zero value will make it an error, try "exit 1" at
the end of your script, you will know if it's executed or not
- Your log file might not be located where you expect, you should use
absolute path to dump text
- Dump the cwd to know where it's executed from
- The documentation says you can print one line before a failure, also
try this to show the cwd

Hope that helps,
Antoine,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git daemon --access-hook problem
  2013-06-03 17:20 ` Antoine Pelisse
@ 2013-06-03 18:02   ` Eugene Sajine
  2013-06-03 19:05     ` Antoine Pelisse
  0 siblings, 1 reply; 6+ messages in thread
From: Eugene Sajine @ 2013-06-03 18:02 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: git

> - Your log file might not be located where you expect, you should use
> absolute path to dump text

You were right! The problem was with the script itself - the log file
not being specified with absolute path! Stupid me!

...
> - The documentation says you can print one line before a failure, also
> try this to show the cwd

Would you be able to advise how this should be done?
I don't get the error message (i mean the output of pwd) if i do this:

echo `pwd`
exit 1

What should it be?

Thanks!
Eugene



>
> Hope that helps,
> Antoine,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git daemon --access-hook problem
  2013-06-03 18:02   ` Eugene Sajine
@ 2013-06-03 19:05     ` Antoine Pelisse
  2013-06-03 20:00       ` Eugene Sajine
  0 siblings, 1 reply; 6+ messages in thread
From: Antoine Pelisse @ 2013-06-03 19:05 UTC (permalink / raw)
  To: Eugene Sajine; +Cc: git

On Mon, Jun 3, 2013 at 8:02 PM, Eugene Sajine <euguess@gmail.com> wrote:
> Would you be able to advise how this should be done?
> I don't get the error message (i mean the output of pwd) if i do this:
>
> echo `pwd`
> exit 1
>
> What should it be?

Actually, after digging into the code, it looks like you need to call
git-daemon with "--informative-errors" if you want to allow custom
errors. Maybe there is place for improvement in the documentation.

Cheers,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git daemon --access-hook problem
  2013-06-03 19:05     ` Antoine Pelisse
@ 2013-06-03 20:00       ` Eugene Sajine
  0 siblings, 0 replies; 6+ messages in thread
From: Eugene Sajine @ 2013-06-03 20:00 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: git

Right, --informative-errors does make it better;)

Actually the CWD for the access-hook is not where the hook script is,
but inside the .git folder of the target repo. GTK.

and yes, definitely some documentation improvements needed;)

Thanks!

On Mon, Jun 3, 2013 at 3:05 PM, Antoine Pelisse <apelisse@gmail.com> wrote:
> On Mon, Jun 3, 2013 at 8:02 PM, Eugene Sajine <euguess@gmail.com> wrote:
>> Would you be able to advise how this should be done?
>> I don't get the error message (i mean the output of pwd) if i do this:
>>
>> echo `pwd`
>> exit 1
>>
>> What should it be?
>
> Actually, after digging into the code, it looks like you need to call
> git-daemon with "--informative-errors" if you want to allow custom
> errors. Maybe there is place for improvement in the documentation.
>
> Cheers,

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-03 20:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-31 20:22 git daemon --access-hook problem Eugene Sajine
2013-06-03  0:33 ` Eugene Sajine
2013-06-03 17:20 ` Antoine Pelisse
2013-06-03 18:02   ` Eugene Sajine
2013-06-03 19:05     ` Antoine Pelisse
2013-06-03 20:00       ` Eugene Sajine

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).