3 ms·
> Git doesn't really have that concept Of locking files? Sure it does; if two people modify the same piece of code, then there will be a merge conflict, and w
by yellowapple 7y ago
> Git doesn't really have that concept
Of locking files? Sure it does; if two people modify the same piece of code, then there will be a merge conflict, and whoever's doing the merge will have the opportunity to reconcile those two versions. It's like a lock, but you don't have to think about it / explicitly lock and unlock the object you're editing. Combine this with rebasing (git-speak for "switch to the branch into which I want to merge and then try applying all the changes from my branch") and you end up with a pretty coherent idea of what changed and in what order.
Having used both branch-oriented (like Git) and locking-oriented (not Perforce specifically, but my current dayjob involves very similar version control schemes), I vastly prefer the former. Less ceremony around doing things in parallel, and less risk of development deadlocks (e.g. Alice locked A.cpp for editing, Bob locked B.dds for editing, Alice now wants to edit B.dds, Bob now wants to edit A.cpp, now Alice will have to revert her lock on A.cpp, wait for Bob to do everything he needs to do, then relock A.cpp and redo her changes all over again (probably also having to debug new things because of new bits and pieces Bob added) - or Bob will have to do so for B.dds - and cue fistfight in the breakroom).
----
That all being said, binary files are indeed a weak spot for Git, so if you really do want to version control your textures and models and sounds and such, then sure, perhaps a different VCS tailored for that use-case would be more ideal. In my experience, though, that tends to be an anti-pattern; generally better to keep code and assets separate (I'm well aware that tools/engines like e.g. Unity don't play the slightest bit nicely with that separation), using separate version control systems tailored to the specific content.
- domlebo70 7y agoSometimes it is desirable to not have optimistic locking like git. Often you want to signal that you don't want a file/asset modified for a period.
- yellowapple 7y agoI think we're gonna have to agree to disagree on that. I've found that locking a file from any changes entirely almost always causes more problems than it ostensibly solves, and is a massive impediment to productivity on any team larger than a single person. The vast majority of the time it's entirely unnecessary anyway.
- domlebo70 7y agoAbsolutely agree with you when it comes to textual/structural information where merge conflicts can be solved easily. But for binary like formats, I feel often there is no way to resolve a conflict.
- joshuamorton 7y agoYes, but you probably don't make a habit of storing music or video (or weird proprietary binary animation formats) that people are modifying in git.
- yellowapple 7y agoIndeed I do not. If game developers (and/or game engine developers; looking at you, Unity3D...) showed similar restraint, then they likely wouldn't feel the need to tie themselves to 90's-esque version control schemes.
- pnako 7y agoThe game industry has a completely different way of working compared to other tech fields. Most of their practices seem old fashioned, or anti-patterns, etc. if you look at them from an outside point of view. But they're trying to do something very hard: control both quality and deadline. It's not like an open source or enterprise IT project. The game has to be finished, good, by a given date. To do that they do many things, including slaughtering sacred cows about how things are supposed to be done. If hard locking saves them time by avoiding wasted efforts, by artists who are probably over-worked already, then what's the problem?
- yellowapple 7y ago> But they're trying to do something very hard: control both quality and deadline. Do you believe other tech fields are not trying to do the same exact thing? Do you believe that enterprise IT projects are somehow less beholden to both quality and deadlines than video games? Controlling both quality and deadlines is what literally every (professional) software development project should be doing. The implication that game developers are somehow better about or more cognizant of this (let alone specifically because of broken development workflows) is pretty rich considering how frequently big-budget video games end up in development hell (see also: Duke Nukem Forever) and/or end up riddled with bugs (see also: literally everything Bethesda's released in the last decade or so). (Not saying that enterprise IT is necessarily better in either regard, of course; bugs and delays are inevitable as software complexity grows, be it an RPG or an ERP...) > If hard locking saves them time It doesn't save time in aggregate, though. It maybe saves time for one specific corner case (conflicting edits on binary files) at the expense of slowing down everything else. And if you're at the point where "conflicting edits on binary files" is no longer a corner case, then that betrays at least one of two dysfunctions: - You're using some sort of container format instead of sanely keeping things split into separate texture/model/animation/normal/behavior/etc. files (and then - if the amalgamated container file is indeed necessary - combining it as part of the build process). If you're really running into a lot of cases where multiple people are trying to edit the exact same normal map at the exact same time, then... - You've got a communications breakdown somewhere. You can band-aid over that with file locking, but that still doesn't address the issue of two people trying to independently edit something in the first place.
- cweagans 7y agoMerge conflicts are definitely not the same thing as file locking. At the point where you're getting a merge conflict, it's too late. How are you going to resolve conflicts in an audio file? File locking is a way to communicate in advance that nobody should attempt to make changes to a particular file until the lock is cleared. Merge conflicts are communication in arrears (so to speak) and at that point, effort has already been wasted by at least one person.
- yellowapple 7y ago> How are you going to resolve conflicts in an audio file? By choosing one and discarding the other, or by creating a new audio file that incorporates both changes, just like one would do for any other file. While I don't know if this exists, there's nothing theoretically preventing the creation of a diffing/patching tool for audio/video files, detecting insertions/deletions/replacements (perhaps by timestamp/frame rather than by line) the same way `diff` does for text. > at that point, effort has already been wasted by at least one person. A file lock doesn't prevent that time waste; there's nothing stopping someone from immediately overwriting it as soon as the first editor commits/releases the lock (in which case the first edit was a complete waste of time).
- wizzwizz4 7y agoA lock prevents you from opening it to edit in the first place, without warnings that "so and so user is currently editing this, are you sure you want to open this as read-only?". This reduces accidental time waste (and computer systems shouldn't try to protect people from deliberately wasting their own time, because they probably aren't).
- joshuamorton 7y agoI don't quite think you understand how perforce works. Locking the file is a signal not to work on it because someone else is modifying it. There isn't currently software that supports semantic merging of audio or video, so perforce says "someone is recoloring the asset, don't change the animation until they're done, or you'll just have to do the work again". In the meantime, perforce prevents you from checking the file out. So you have to explicitly and clearly bypass your source control to do what you suggest, at which point someone rightfully yells at you.