-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
status=0 | ||
|
||
PRECIOUS=$(which precious) | ||
if [[ -z $PRECIOUS ]]; then | ||
PRECIOUS=./bin/precious | ||
fi | ||
|
||
if ! "$PRECIOUS" lint -s; then | ||
status=$((status + 1)) | ||
fi | ||
|
||
exit $status |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Cwd qw( abs_path ); | ||
|
||
symlink_hook('pre-commit'); | ||
|
||
sub symlink_hook { | ||
my $hook = shift; | ||
|
||
my $dot = ".git/hooks/$hook"; | ||
my $file = "git/hooks/$hook.sh"; | ||
my $link = "../../$file"; | ||
|
||
if ( -e $dot ) { | ||
if ( -l $dot ) { | ||
return if readlink $dot eq $link; | ||
} | ||
warn "You already have a hook at $dot!\n"; | ||
return; | ||
} | ||
|
||
symlink $link, $dot | ||
or die "Could not link $dot => $link: $!"; | ||
} |