Skip to content

Instantly share code, notes, and snippets.

@rage-shadowman
Last active January 12, 2016 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rage-shadowman/6471929 to your computer and use it in GitHub Desktop.
Save rage-shadowman/6471929 to your computer and use it in GitHub Desktop.
This is a git pre-receive hook for backups of git-svn clones to keep from pushing anything to the backup repository that doesn't have a git-svn-id (reject anything that did not get dcommitted first). Recommended for backups created using: https://gist.github.com/rage-shadowman/6472005
#!/bin/sh
. git-sh-setup
read oldValue newValue refName
if ! git log -1 $newValue | grep -q '^ git-svn-id: '
then
echo "Must not commit to Git unless already dcommitted to SVN!"
exit 1
fi
@rage-shadowman
Copy link
Author

I'm not sure the git-sh-setup line is needed. I just stuck it in there while I was writing the thing and never removed it since it is working and this file was propagated to all my repos anyway as they are under gitolite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment