summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-12-06 11:42:52 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2015-12-07 09:06:32 -0500
commit86e46630ed8af8d94796859db550a9c3d89c9f65 (patch)
tree1898b540ff40a486f9335a7fd7b3bf1e2336b271
parentb05b9cb537caadd9e34039037fe833b9d858fb9f (diff)
downloadgstreamer-common-86e46630ed8af8d94796859db550a9c3d89c9f65.tar.gz
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
-rwxr-xr-xautogen.sh.in6
1 files changed, 5 insertions, 1 deletions
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.