Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

pre-fetch hook functionality in git

in my scenario i maintain a svn-synchronized git repository on a server. all developers in my group use this repository to get their updates.
i couldn't find a way to trigger an automatic "git svn fetch" (or any other command) before a developer fetches the latest changes.
my current workaround is to have a cron job that syncs in svn related changes every 5 minutes. is it possible to have this kind of a pre-fetch hook at all?
thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is no pre-defined hook that will allow you to do exactly what you want.

If your developers are fetching over ssh, you might be able to create a wrapper script for git-upload-pack which hides the real git-upload-pack and calls git svn fetch on the repository (while being absolutely sure to squash all output and errors) before execing the real git-upload-pack.

This might be quite fiddly to set up and make robust, though. You might be better off providing a way for your developers to manually cause a call to git svn fetch on the remote repository and encouraging them to use an alternative fetch alias that does this first (and waits for it to complete!) before doing the real fetch.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...