git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git fails to detect subcommand when hook is symlinked to a builtin

From
Todd Zullinger <tmz@pobox.com>
Date
Mar 18, 2011, 15:14 UTC
Message-ID
<20110318151415.GC26236@inocybe.localdomain>

I'm not sure if this is a bug or more of a "don't do that" sort of thing. At fedorahosted.org, the git repositories are mounted on a filesystem with noexec. As such, we have all hooks symlinked elsewhere. For the post-update hook we used to link directly to git-update-server-info.

This worked until we upgraded the system to git-1.7.4.1 recently. A trace may help illustrate:

With hooks/post-update as a symlink to /usr/bin/git-update-server-info:

trace: run_command: 'hooks/post-update' 'refs/heads/master' trace: run_command: 'gc' '--auto' '--quiet' remote: trace: exec: 'git-refs/heads/master' remote: trace: run_command: 'git-refs/heads/master' remote: git: 'refs/heads/master' is not a git command. See 'git --help'.

With hooks/post-update as a symlink to /usr/share/git-core/templates/hooks/post-update.sample:

trace: run_command: 'hooks/post-update' 'refs/heads/master' remote: setup: git_dir: . remote: setup: worktree: (null) remote: setup: cwd: /home/fedora/tmz/tmp/iwhd.git remote: setup: prefix: (null) remote: trace: built-in: git 'update-server-info'

Is there any reasonable way to handle this case? Perhaps if the symlink were dereferenced (if no subcommand were found) and then re-checked for a subcommand? I admit that I did not delve too deeply into the code, but from the little I did I wasn't sure that any changes here wouldn't lead to worse troubles.

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Everyone needs to believe in something. I believe I'll have another
beer.
Next: Junio C Hamano
Message 1 of 6 in “Git fails to detect subcommand when hook is symlinked to a builtin”
  1. Todd ZullingerMar 18, 2011
  2. Junio C HamanoMar 19, 2011
  3. Todd ZullingerMar 19, 2011
  4. Junio C HamanoMar 19, 2011
  5. Jonathan NiederMar 20, 2011
  6. Jonathan NiederMar 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.