Commit 86e46630 authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

Pre-commit: Fallback to copy when symlink does not work

On certain filesystems like FAT, NTFS and some network file systems,
symlinks are not supported. In those case, installing the pre-commit
hook fails and leaves the developers with having to run the style
checker manually.

Instead, fallback to copy. This should enable the commit hook for
users of filesystems and certain OSs where symlinks are not supported.

https://bugzilla.gnome.org/show_bug.cgi?id=759089
parent b05b9cb5
...@@ -28,7 +28,11 @@ fi ...@@ -28,7 +28,11 @@ fi
if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \); if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
then then
rm -f .git/hooks/pre-commit rm -f .git/hooks/pre-commit
ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit if ! ln -s ../../common/hooks/pre-commit.hook .git/hooks/pre-commit 2> /dev/null
then
echo "Failed to create commit hook symlink, copying instead ..."
cp common/hooks/pre-commit.hook .git/hooks/pre-commit
fi
fi fi
# GNU gettext automake support doesn't get along with git. # GNU gettext automake support doesn't get along with git.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment