From 86e46630ed8af8d94796859db550a9c3d89c9f65 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sun, 6 Dec 2015 11:42:52 -0500 Subject: 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 --- autogen.sh.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autogen.sh.in b/autogen.sh.in index 83644f9..b5cda46 100755 --- a/autogen.sh.in +++ b/autogen.sh.in @@ -28,7 +28,11 @@ fi if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \); then 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 # GNU gettext automake support doesn't get along with git. -- cgit v1.2.1