summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'project.py')
-rw-r--r--project.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/project.py b/project.py
index 99ef238f..d83dd2d7 100644
--- a/project.py
+++ b/project.py
@@ -2860,19 +2860,23 @@ class Project(object):
2860 if platform_utils.islink(dst): 2860 if platform_utils.islink(dst):
2861 continue 2861 continue
2862 if os.path.exists(dst): 2862 if os.path.exists(dst):
2863 if filecmp.cmp(stock_hook, dst, shallow=False): 2863 # If the files are the same, we'll leave it alone. We create symlinks
2864 platform_utils.remove(dst) 2864 # below by default but fallback to hardlinks if the OS blocks them.
2865 else: 2865 # So if we're here, it's probably because we made a hardlink below.
2866 if not filecmp.cmp(stock_hook, dst, shallow=False):
2866 if not quiet: 2867 if not quiet:
2867 _warn("%s: Not replacing locally modified %s hook", 2868 _warn("%s: Not replacing locally modified %s hook",
2868 self.relpath, name) 2869 self.relpath, name)
2869 continue 2870 continue
2870 try: 2871 try:
2871 platform_utils.symlink( 2872 platform_utils.symlink(
2872 os.path.relpath(stock_hook, os.path.dirname(dst)), dst) 2873 os.path.relpath(stock_hook, os.path.dirname(dst)), dst)
2873 except OSError as e: 2874 except OSError as e:
2874 if e.errno == errno.EPERM: 2875 if e.errno == errno.EPERM:
2875 raise GitError(self._get_symlink_error_message()) 2876 try:
2877 os.link(stock_hook, dst)
2878 except OSError:
2879 raise GitError(self._get_symlink_error_message())
2876 else: 2880 else:
2877 raise 2881 raise
2878 2882