ghc - How to execute a command right after a fetch or pull command in git? -


i cloned ghc (glasgow haskell compiler) repository. in order build compiler, need several libraries, of them available git repositories too. in order ease ones live, ghc hackers included script sync-all that, when executed, updates dependent repositories.

now question: how can make git execute ./sync-all pull after did git pull automatically? heard using hooks, don't know, have do.

a post-receive or post-update hook used kind of task, executed after each push.
difference between post-receive , post-update hooks in arguments: post-receive both old , new values of refs in addition names.

the missing piece is: where hook executes itself?

the blog post "missing git hooks documentation" (a great) contributor mark longair sheds light on this:

the current working directory git directory.

  • so, if bare repository called “/src/git/test.git/”, current working directory – if non-bare repository , top level of working tree “/home/mark/test/” current working directory “/home/mark/test/.git/

chris johnsen details in so answer: "if –-git-dir or git_dir specified none of -–work-tree, git_work_tree , core.worktree specified, current working directory regarded top directory of working tree."

in other words, working tree current directory (the .git directory), which isn’t want.

make sure hook/post-receive script, once created , made executable, sets git_work_tree @ right path, in order ./sync-all pull executed in right directory (i.e. not "xxx.git" one).


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -