threads / discuss / 28920

RFC: post-fetch hook

Subject: RFC: post-fetch hook

## tl;dr

One message between Nov 12, 2011 and Nov 12, 2011.

replies: 0people: 1as markdown or json

Joey Hess· Nov 12, 2011, 19:44 UTC · lore

A post-fetch hook would run on the local repository after a git-fetch or git-pull. It would probably make sense for the hook to be sent the same format input as the post-receive hook (although I don't need that information myself). Like post-receive, it would not affect the outcome of the fetch. It should be called late enough that it can manipulate the git repository using the fetched refs.

My use case is in git-annex. It maintains its own, rather notes-like branch. When remote versions of the branch have changed, they are automatically merged into the local branch, using a union merge, the next time git-annex is run. So normally it does not need this hook.

But, consider the case where git-annex has locally modified its branch, and the remote tracking branch has also been modified. Now the user does "git pull; git push". With the two git-annex branches diverged the push fails. The user has to manually run "git annex merge" before pushing to handle this.

If there was a post-fetch hook, git-annex could make it always run git annex merge, and users would not need to deal with this situation.

-- 
see shy jo

← back to recent threads