Skip to content

Instantly share code, notes, and snippets.

View danbeaulieu's full-sized avatar

Dan Beaulieu danbeaulieu

View GitHub Profile
@danbeaulieu
danbeaulieu / pre-commit.bash
Created May 3, 2012 18:28 — forked from brentsowers1/pre-commit.bash
Git pre-commit hook to prevent non-ascii characters
#!/bin/bash
# Save these contents to .git/hooks/pre-commit in your project
# folder, and give it executable permissions with
# "chmod u+x .git/hooks/pre-commit"
# Git will abort a commit if you have non ASCII characters in
# the commit, and output the non ASCII characters.
output=`git diff HEAD | tr -d "\000-\011\013-\177" | tr -d '\n'`
cnt=${#output}
if [ -n "$output" ]; then
@danbeaulieu
danbeaulieu / pre-commit.bash
Created May 3, 2012 18:28 — forked from brentsowers1/pre-commit.bash
Git pre-commit hook to prevent non-ascii characters
#!/bin/bash
# Save these contents to .git/hooks/pre-commit in your project
# folder, and give it executable permissions with
# "chmod u+x .git/hooks/pre-commit"
# Git will abort a commit if you have non ASCII characters in
# the commit, and output the non ASCII characters.
output=`git diff HEAD | grep ^+[^+] | tr -d "\000-\011\013-\177" | tr -d '\n'`
cnt=${#output}
if [ -n "$output" ]; then