Created
October 29, 2012 16:17
-
-
Save M1ke/3974575 to your computer and use it in GitHub Desktop.
Shell file for hooks on Windows with mysysgit installed (includes curl if in path) and powershell code for systems without curl.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$liveCommitClient = new-object System.Net.WebClient; | |
$liveCommitMessage = git show --format='%s' --name-only HEAD | |
$liveCommitClient.DownloadFile("http://dashboard.hackmanchester.com/commits?git&message="+ $liveCommitMessage + "&user=73&secret=4aYGnJ3gKotIeUztieyV&files=" , "c:\tmp\null"); | |
echo 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# name as post-commit in a .git/hooks directory | |
# | |
# An example hook script that is called after a successful | |
# commit is made. | |
# | |
# To enable this hook, rename this file to "post-commit". | |
curl -d "output=`git show --format='git&message=%s&user=73&secret=4aYGnJ3gKotIeUztieyV&files=' --name-only HEAD`" http://dashboard.hackmanchester.com/commits |
This is awesome @M1ke! Next step would be for me to get it saveable in the source of the dashboard itself (so it interpolates the right user id and domain etc).
Is it possible to get the Windows temp directory out of the Windows environment? That way we don't need to assume it will be on C: drive and in the tmp folder :)
Windows environment variable $TMP
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crucially, placing the PowerShell code into the post-commit file doesn't seem to work. Without the line #!/bin/sh git will report "error: cannot spawn .git/hooks/post-commit: No such file or directory". So some form of top comment or shebang is needed but I can't work out which. If pasted into powershell whilst inside a git repo the above code will run and update the site.
When using the curl code it is essential that no new lines at the top or tabs are added when saving in Windows.