Founder Notes
The Untidy Thing Was Almost Free
My laptop ran out of disk. Half a terabyte of it, down to a couple of gigabytes free, and the machine had started refusing to do ordinary things.
I knew what the cause was before I looked. That is the part of this worth writing down.
I work across a lot of branches, which on this machine means a lot of separate checkouts. When I finally counted them, there were a hundred and seventy-five full clones sitting on that disk, covering sixty-four distinct repositories. A dozen copies of one. A dozen of another. Eleven of a third.
That is indefensible, and it is a satisfying kind of indefensible to find. A dozen copies of the same repository is not an accident you can explain away; it is a habit. I had my cause. All that remained was to work out the order to remove things in.
So I priced it.
The number came back trivial
Twelve copies of the first repository came to three tenths of a gigabyte of history, all twelve together. Twelve copies of the second came to one and three tenths. Eleven copies of the third, the worst by count, came to four.
Across the repositories I checked, the entire cost of having kept every duplicate copy of every history was about fourteen gigabytes, on a disk holding nearly four hundred. And nine of that fourteen came from one repository whose history is enormous in a single copy, which means most of my headline figure was not a duplication cost at all.
A hundred and seventy-five clones was untidy. It was not expensive.
What was expensive was the category I had walked straight past on the way to my suspect: build output. Installed dependencies, virtual environments, compiled caches. A single sweep of exactly that, across forty-eight directories, later gave back fifty-one gigabytes.
Why I had the wrong suspect
I want to be exact about the mistake, because "I guessed wrong" is not a lesson.
I did not mistake a small number for a large one. I never had a number. I had a structural judgment, which was that this arrangement is wasteful, and I let it stand in for a quantity. It arrived with the confidence of something observed rather than something assumed, and I never noticed the difference, because the judgment was correct.
It was. The duplication is real. Keeping a dozen copies of one repository is as careless as it sounds. It simply does not cost anything, because what gets duplicated when you clone is history, and history is text, and text compresses. What costs is what each copy builds once it lands, and that is not a copy of anything. It is new.
That is the whole asymmetry. The thing that looked careless was nearly free, and the thing that was expensive looked legitimate. Every one of those build directories was produced by a tool doing its job, for a checkout I had a reason to make. None of them looks like waste. They are the output of the process everyone agrees should be running.
The general form
Wasteful is a judgment about structure. Expensive is a quantity. They are independent of each other, and only one of them is a measurement.
When a shared resource runs out, the suspect list writes itself out of whatever looks careless, and carelessness is a poor predictor of cost. The costly things tend to look legitimate, because the legitimate parts of a system are the parts nobody is embarrassed about, and so nobody counts them.
The remedy is not a better instinct. It is an ordering: price the suspects before you rank them, and be ready for the answer that the mess is not the problem. That is an uncomfortable result, because the mess is still a mess and you now have to go and find the real one. I would rather have been right about the clones.