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 24, 2008, 15:00 UTC
Message-ID
<20080924150056.GY21650@dpotapov.dyndns.org>
In-Reply-To
<alpine.LNX.1.00.0809232330050.19665@iabervon.org>
On Wed, Sep 24, 2008 at 12:15:39AM -0400, Daniel Barkalow wrote:
Show 10 quoted lines
> On Wed, 24 Sep 2008, Dmitry Potapov wrote:
> 
> > 
> > What are you saying is that when I am locking some file on the current
> > branch, Git (or whatever script that performs this locking) should figure
> > out what is the original shared branch for it and lock the file there.
> 
> Or you should have to say. But "git lock <filename>" should probably 
> put the lock on whatever branch "git push" would push to, and similarly 
> for the other argument combinations that "git push" permits.

It seems to me very fragile to rely on the push configuration in deciding what can be locked and what cannot. Besides this configuration can change over time. So what is going to happen with locks then? Another problem: what if I don't push anyway but usually send pull-requests?

The fact is if you cannot get your locking working in _one_ repository then any hope that it will work when you have more than one is nothing but a pipe dream.

Show 8 quoted lines
> 
> > Maybe, it can work, but it sounds too complex to me. I believe that my
> > idea using SHA-1 is better. After all, what is file? It is its content.
> > At least, in Git, we always identify files by their content.
> 
> Not at all; there are plenty of cases where what matters is the path, and 
> some things are relevant by virtue of the form of the filename which names 
> that content.

Whether it matters or not depends on a particular workflow and what the developer wants to achieve. Such decisions should be taken by human being, otherwise you are prone to do the wrong things too often.

Show 10 quoted lines
> 
> > Thus if you lock some file, you put a lock on certain SHA-1. Now, 
> > regardless of branches and paths, this lock can work provided that you 
> > have access to some shared location. Of course, this lock is purely 
> > advisory, but it is good, because you may want to ignore it in some 
> > case.
> 
> In my design, the lock (on the shared repository) is not advisory; if 
> someone else has it, you can't push if the new commit doesn't match the 
> old commit for that path.

Hey, if someone wants to push this file, it means it is already late, because you _already_ have the situation where two people have edited exactly the same binary file. Isn't the situation that the lock was intended to prevent?

So, the goal should be to warn someone who is going to edit file locked by someone else. You cannot prevent him/her from doing so, only to warn about that.

As to pushing, it can be different policies. IMHO, the update hook is the best place to express what push you want to allow and what not, but some workflow may not use push at all, yet ability to lock (perhaps, 'synchronize' would be a better word here) may still be needed.

Dmitry
Previous: Daniel BarkalowNext: Dmitry Potapov
Message 18 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.