git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Mario Pareja <mpareja.dev@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Locking binary files
Date: Tue, 23 Sep 2008 09:18:20 +0200	[thread overview]
Message-ID: <48D8983C.7070506@op5.se> (raw)
In-Reply-To: <94c1db200809222339t7d65081eq7471fef86fb5ec73@mail.gmail.com>

Mario Pareja wrote:
> Hi,
> 
> For one and a half years, I have been keeping my eyes on the git
> community in hopes of making the switch away from SVN.  One particular
> issue holding me back is the inability to lock binary files.
> Throughout the past year, I have yet to see developments on this
> issue.  I understand that locking files goes against the fundamental
> principles of distributed source control, but I think we need to come
> up with some workarounds.  For Linux kernel development this is may
> not be an issue; however, for application development this is a major
> issue. How else can one developer be sure that time spent editing a
> binary file will not be wasted because another developer submitted a
> change?
> 

Because they will cause merge conflicts when you try to bring the
histories together. Some binary formats can be edited by multiple
users at the same time, while others can't, so git will try to merge
those binary files for you. For images, that almost certainly won't
go so well so it will result in a conflict.

> To achieve the effects of locking, a "central" repository must be
> identified.

To achieve distributedness no central repository must exist. Locking
can be done by some other means.

>  Regardless of the distributed nature of git, most
> _companies_ will have a "central" repository for a software project.

Actually, all projects with some sort of userbase will probably have
some official "here's the published code suitable for production use"
repository. To say that it's the "central" one is a bit off though.
It's merely a public place that can be referred to for convenience.

> 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?
> 
> In any case, I think this is a crucial issue that needs to be
> addressed if git is going to be adopted by companies with binary file
> conflict potential. I don't see how a web development company can take
> advantage of git to track source code and image file changes.  Any
> advice would be great!
> 

Try and find out.

mkdir foo && cd foo && git init
cp /random/binary/file.png image.png
git add image.png && git commit -m"first commit"
git checkout -b A
cp /other/random/binary/file.png image.png
git add image.png && git commit -m"conflicting commit"
git checkout -b B master
cp /third/random/binary/file.png image.png
git add image.png && git commit -m"non-conflicting commit"
git checkout master
cp /third/random/binary/file.png image.png
git add image.png && git commit -m"master says 'so be it'"

git merge B; # works, since the binary files are the same
git merge A; # produces a conflict message


In which way is that not exactly the right behaviour?
How would locking have helped?

If your colleagues are replacing files you committed so
that your code suddenly fails, you have a communication
(and QA) issue at work. Adding locking to git is not the
solution to that problem. Introducing a sort of builtin
notion of a central repository is, frankly, disgusting.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

  reply	other threads:[~2008-09-23  7:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <94c1db200809222333q4953a6b9g8ce0c1cd4b8f5eb4@mail.gmail.com>
2008-09-23  6:39 ` Locking binary files Mario Pareja
2008-09-23  7:18   ` Andreas Ericsson [this message]
     [not found]     ` <94c1db200809230054t20e7e61dh5022966d4112eee6@mail.gmail.com>
2008-09-23  8:31       ` Andreas Ericsson
2008-09-23 13:56         ` Mario Pareja
2008-09-23 14:28           ` Alex Riesen
2008-09-23 17:32           ` Daniel Barkalow
2008-09-23 19:49             ` Junio C Hamano
2008-09-23 21:13               ` Daniel Barkalow
2008-09-23 21:54                 ` Dmitry Potapov
2008-09-23 22:29                   ` Daniel Barkalow
2008-09-23 23:21                     ` Dmitry Potapov
2008-09-24  4:15                       ` Daniel Barkalow
2008-09-24 15:00                         ` Dmitry Potapov
2008-09-23 20:46           ` Dmitry Potapov
2008-09-23 11:16   ` Boaz Harrosh
2008-09-23 11:20     ` Boaz Harrosh
2008-09-23 14:14     ` Mario Pareja
2008-09-23 14:35       ` Boaz Harrosh
2008-09-23 13:44   ` Dmitry Potapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D8983C.7070506@op5.se \
    --to=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=mpareja.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).