Question

I'm trying to create a zip archive of my project when I push to the svn server. My old setup would use a post-receive hook on the remote git repo to do this. However, I'm now using svn and I don't own the svn server so I can't put anything over there. I've set up the following pre-push hook but this isn't running on git svn dcommit:

$cat .git/hooks/pre-push
#!/bin/sh
git archive -o foo_bar.zip --prefix foo_bar/ master

Any ideas on which hook I could use?

Thanks!

Était-ce utile?

La solution 2

Since there is no such hook, how about creating an alias instead?

dcm = "!f(){ git archive -o foo_bar.zip --prefix foo_bar/ master; git svn dcommit; }; f"

Autres conseils

You are using git-svn, right? You haven't cited it anywhere, so I'm not sure you are. Those git-hooks won't work with pure svn, you must be using git! It can be obvious, but better to be sure.

As to your problem, you could probably use a post-commit hook: once you finished a commit you zip things up. The downside to this, is that you won't have the zip file added to your repo.

If you need the zip on the repository, use the pre-commit hook and stash your tree. You can easily archive this tree, add the zipped file to the git index, and your done!

This answer might help you scripting this: Git archive of repository with uncommitted changes.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top