3 ms·
Not sure I understand the problem. If I lock fileX and go to lunch, then I own the lock on that file while I’m out to lunch. It’s basically analogous me pushing
by alkonaut 7y ago
Not sure I understand the problem. If I lock fileX and go to lunch, then I own the lock on that file while I’m out to lunch. It’s basically analogous me pushing the file fileX.lock to the repo next to fileX, with my user id as content. I can only do it if it isn’t there.
Everyone else will only see that lock if they fetch and if they don’t, they might edit their local copy of fileX too, but would be prevented from pushing their version to the blessed repository by the lock. They can push a copy under another name, or wait until I have removed the lock (but probably can’t resolve the conflict anyway because it’s likely a binary document). So they user will remember to never start editing without taking the lock in the future.
It’s not perfect by any stretch of the imagination but it’s all anyone asks for in terms of file locking. It’s what Subversion always did.
- wyoung2 7y ago> Not sure I understand the problem. If I lock fileX and go to lunch, then I own the lock on that file while I’m out to lunch. And if you go on vacation for two weeks instead?
- alkonaut 7y agoSame thing obviously. But this is just a method of communication. It’s instead of emailing/shouting “don’t edit the background image today please” across the office. An admin can remove the lock. Or you can allow force-pushing by anyone to replace it or whatever. Not sure why this is seen as so complicated, version control systems have done it since forever. It’s not trying to solve some distributed lock system in a clever way. It’s dumb centralized mutex per file. And yet again this is all that’s needed (and it’s also added to git in git-LFS!).