Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell file for hooks on Windows with mysysgit installed (includes curl if in path) and powershell code for systems without curl.
$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
#!/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
@M1ke

This comment has been minimized.

Show comment
Hide comment
@M1ke

M1ke Oct 29, 2012

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.

Owner

M1ke commented Oct 29, 2012

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.

@seanhandley

This comment has been minimized.

Show comment
Hide comment
@seanhandley

seanhandley Nov 4, 2012

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).

seanhandley commented Nov 4, 2012

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).

@seanhandley

This comment has been minimized.

Show comment
Hide comment
@seanhandley

seanhandley Nov 4, 2012

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 :)

seanhandley commented Nov 4, 2012

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 :)

@M1ke

This comment has been minimized.

Show comment
Hide comment
@M1ke

M1ke Nov 6, 2012

Windows environment variable $TMP

Owner

M1ke commented Nov 6, 2012

Windows environment variable $TMP

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