|
1 | 1 | # git-hooks-install.ps1
|
2 | 2 | # by wilsonmar at gmail.com
|
3 |
| -# After the repo is cloned, this PowerShell script copies |
4 |
| -# scripts in the repo's hooks folder into the .git/hooks |
| 3 | +# After the repo is cloned, this PowerShell multi-platform script |
| 4 | +# copies scripts in the repo's hooks folder into the .git/hooks |
5 | 5 | # and sets permissions.
|
6 | 6 |
|
7 |
| -echo "Remove *.sample files in .git/hooks ..." |
| 7 | +#echo "Remove *.sample files in .git/hooks ..." |
8 | 8 | Remove-Item .git/hooks/*.sample
|
9 | 9 |
|
10 |
| -echo "Copy hooks/git-commit into .git/hooks ..." |
11 |
| - |
| 10 | +#echo "Copy hooks/git-commit into .git/hooks ..." |
12 | 11 | Copy-Item hooks/* .git/hooks
|
13 | 12 | #Copy-Item hooks/git-commit .git/hooks
|
14 | 13 | #Copy-Item hooks/git-push .git/hooks
|
15 | 14 | #Copy-Item hooks/git-rebase .git/hooks
|
16 | 15 | #Copy-Item hooks/prepare-commit-msg .git/hooks
|
17 | 16 |
|
18 |
| -if( $IsWindows -eq $True ) { |
19 |
| - # icacls |
20 |
| -} |
21 |
| -if ( $IsOSX -eq $True){ |
22 |
| - chmod +x .git/hooks/git-commit |
23 |
| - chmod +x .git/hooks/git-push |
24 |
| - chmod +x .git/hooks/git-rebase |
25 |
| - chmod +x .git/hooks/prepare-commit-msg |
| 17 | +#echo "Change permissions ..." |
| 18 | +$SUBDIR=".git/hooks" |
| 19 | +Get-ChildItem "$SUBDIR" -Filter *.log | |
| 20 | +Foreach-Object { |
| 21 | + $content = Get-Content $_.FullName |
| 22 | + echo $content |
| 23 | + if( $IsWindows -eq $True ) { |
| 24 | + # attrib to set file permissions |
| 25 | + # icacls to set ownership in Access Control Lists |
| 26 | + } |
| 27 | + if ( $IsOSX -eq $True){ |
| 28 | + chmod +x $SUBDIR$content |
| 29 | + } |
26 | 30 | }
|
27 | 31 |
|
| 32 | +#echo "Change permissions ..." |
28 | 33 | ls .git/hooks
|
29 | 34 |
|
30 |
| -# echo "Done with status $? (0=OK)." |
| 35 | +echo "Done with status $? (0=OK)." |
0 commit comments