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

Re: Locking binary files

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Sep 23, 2008, 13:44 UTC
Message-ID
<20080923134446.GM21650@dpotapov.dyndns.org>
In-Reply-To
<94c1db200809222339t7d65081eq7471fef86fb5ec73@mail.gmail.com>
On Tue, Sep 23, 2008 at 02:39:41AM -0400, Mario Pareja wrote:
> 
> How else can one developer be sure that time spent editing a
> binary file will not be wasted because another developer submitted a
> change?

That sounds to me more like a communication problem than anything related to Git itself.

Show 7 quoted lines
> 
> To achieve the effects of locking, a "central" repository must be
> identified.  Regardless of the distributed nature of git, most
> _companies_ will have a "central" repository for a software project.
> We should be able to mark a file as requiring a lock from the
> governing git repository at a specified address.  Is this made
> difficult because git tracks file contents not files?

The problem exists regardless the distributed nature of git. Let's consider a single repository with only two branches: A and B. Now, one developer has decided to edit some binary file called pretty.img on A. Should this file be locked only on the branch A or on both branches? The answer is if A is going to merge to B then this file on B too and remain locking till A is merged to B. In fact, it may be *absolutely* pointless to lock the file on the developer's topic branch, because another developer can edit it on another topic branch without noticing that this lock exists at all. So, it may be enough to lock it only B enough, but this is impossible to Git to know, because Git does not understand _your_ particular workflow, and without any locking scheme is rather meaningless.

Perhaps, a more general solution can be based exactly on the content, not on the name, i.e. in some share directory on the server I create a file with name based on SHA-1 of the binary file where I put comment explaining why I locked it. Obviously, this lock is purely advisory, but it is good, in some situation you really may want to edit two files with the same SHA-1 on different branches that never get merge. Moreover, this lock is never deleted. So, it could make sense instead of having a separate file per lock to organize it in some more compact storage, which may look like history of editing binary files... But it is just an idea how I would do that.

Dmitry
Previous: Boaz HarroshNext: Andreas Ericsson
Message 7 of 19 in “Re: Locking binary files”
  1. Mario ParejaSep 23, 2008
  2. Andreas EricssonSep 23, 2008
  3. Boaz HarroshSep 23, 2008
  4. Boaz HarroshSep 23, 2008
  5. Mario ParejaSep 23, 2008
  6. Boaz HarroshSep 23, 2008
  7. Dmitry PotapovSep 23, 2008
  8. Andreas EricssonSep 23, 2008
  9. Mario ParejaSep 23, 2008
  10. Alex RiesenSep 23, 2008
  11. Daniel BarkalowSep 23, 2008
  12. Junio C HamanoSep 23, 2008
  13. Daniel BarkalowSep 23, 2008
  14. Dmitry PotapovSep 23, 2008
  15. Daniel BarkalowSep 23, 2008
  16. Dmitry PotapovSep 23, 2008
  17. Daniel BarkalowSep 24, 2008
  18. Dmitry PotapovSep 24, 2008
  19. Dmitry PotapovSep 23, 2008

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.