Deep Fowdar has proposed merging ~superalpaca/turnip:fix-ensure-hooks-bug into
turnip:master.
Commit message:
Fix issue when overriding symlinked hooks over NFS
When overriding already symlinked hooks over NFS, the rename step
can briefly unlink the hook from the perspective of another machine,
meaning that git subprocesses won't run the python hook.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~superalpaca/turnip/+git/turnip/+merge/453652
--
Your team Launchpad code reviewers is requested to review the proposed merge of
~superalpaca/turnip:fix-ensure-hooks-bug into turnip:master.
diff --git a/turnip/pack/helpers.py b/turnip/pack/helpers.py
index 9536e05..ad444dc 100644
--- a/turnip/pack/helpers.py
+++ b/turnip/pack/helpers.py
@@ -187,6 +187,15 @@ def ensure_hooks(repo_root):
os.rename(this.name, hook_path(target_name))
for hook in wanted_hooks:
+ # Skip already symlinked hooks. This is required because over NFS,
+ # the rename below can briefly unlink the hook from the perspective of
+ # another machine, meaning that git subprocesses won't run the python
+ # hook
+ try:
+ if os.readlink(hook_path(hook)) == target_name:
+ continue
+ except Exception:
+ pass
# Not actually insecure, since os.symlink fails if the file exists.
path = mktemp(dir=hook_path("."))
os.symlink(target_name, path)
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp