git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Interest in locking mechanism?

From
Tomas Carnecky <tom@dbservice.com>
Date
Jan 12, 2010, 18:37 UTC
Message-ID
<4B4CC17B.30303@dbservice.com>
In-Reply-To
<28c656e21001121029h42544f3er6eedf8465851fec1@mail.gmail.com>
On 01/12/2010 07:29 PM, B Smith-Mannschott wrote:
Show 16 quoted lines
> On Tue, Jan 12, 2010 at 19:10, Edward Z. Yang<ezyang@mit.edu>  wrote:
>> I have a few friends that still use RCS for their version control
>> needs.  We have argued over various points between RCS and Git, and
>> as far as I can tell the one thing RCS has that Git does not is
>> a locking mechanism.  That is to say, co -l checks out a file and
>> also gives you a lock on it, preventing others from futzing with it,
>> and ci -u checks in the file and releases your lock.  This is
>> useful if you have a shared working copy on a multiuser system or
>> on a network file system, and you don't want conflicts.
>>
>> I was wondering if there would be interest in such a feature on
>> the Git developers side.
>
> How do you imagine that this would work in a distributed system such
> as git? What would it mean to have the lock for "a file", when each
> user effectively has their own branch?

He mentioned a shared working copy, in which case there can be problems if multiple users edit the same file.

Usually you'd work around that by cloning the repo, working in the clone, and push the result back. This can get a bit tricky if the main repository is not bare, but there is a solution even to that (either explicitly run git reset --hard or have a post-receive hook which updates the working tree).

tom
Previous: Edward Z. YangNext: Avery Pennarun
Message 4 of 11 in “Interest in locking mechanism?”
  1. Edward Z. YangJan 12, 2010
  2. B Smith-MannschottJan 12, 2010
  3. Edward Z. YangJan 12, 2010
  4. Tomas CarneckyJan 12, 2010
  5. Avery PennarunJan 12, 2010
  6. Edward Z. YangJan 12, 2010
  7. Avery PennarunJan 12, 2010
  8. Martin LanghoffJan 12, 2010
  9. Edward Z. YangJan 12, 2010
  10. Avery PennarunJan 12, 2010
  11. Martin LanghoffJan 12, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.