1

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!

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I believe I'm just using the plain vanilla git which now includes svn support. I was hoping to not have to create an archive every time I commit a change.
1

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"

2 Comments

nice. It works. Now, I just need to brush up on git commands to figure out why it works :)
It's simple, actually: there's just a one-line function there, f(){ ...; }, which has the commands you want to run, and right after the f to call the function and execute the commands. This is bash syntax btw.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.