[linux-elitists] Fun with Git repository copying

Don Marti dmarti at zgp.org
Sat Apr 13 07:45:39 PDT 2013

What happens when you're doing a copy of a Git
repository that's in the process of being pushed to
or garbage collected?



Sometimes, bad things.

Here's a hypothetical game.

Let's say that programmer A has the job of
implementing POSIX cp(1), but has decided to do it
in a way that will pass the "cp" test suite but order
the file copying to maximize the chances of breaking
copies of Git repositories that are being changed
during the copy.  (For example, "evil cp" might see
if there are any subdirectories directories named
"objects", copy their contents first, then pause,
then copy the rest.)

Programmer B has decided to extend Git to defend
against "evil cp" so that the copy is usable, even if
"evil cp" and a large push and repack happened at
the same time.

A has full access to the Git source code and mailing
list.  B is aware of the existence of "evil cp"
but not the details of what it does.

Who wins?

Don Marti                      +1-510-332-1587 (mobile)
http://zgp.org/~dmarti/        Alameda, California, USA
dmarti at zgp.org

More information about the linux-elitists mailing list