Re: [PATCH 4/3] git-fetch: test avoiding unnecessary copying from alternates
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Nov 8, 2007, 08:34 UTC
- Message-ID
- <20071108083440.GK14735@spearce.org>
- In-Reply-To
- <20071108082213.GA17054@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> wrote:
> This test verifies my prior "avoid local fetching from alternate" > patch is functional and doesn't regress in the future during any > additional improvements made to git.
...
Show 9 quoted lines
> +test_expect_success 'quickfetch should not copy from alternate' ' > + > + ( > + mkdir quickclone && > + cd quickclone && > + git init-db && > + (cd ../.git/objects && pwd) >.git/objects/info/alternates && > + git remote add origin .. && > + git fetch -k -k
Hmmph. On second thought I think this is a little sketchy for a test. Versions without my quickfetch patch fail this test and versions with it pass. But it depends on the implementation of `-k -k` to always call index-pack over unpack-objects.
I'm using -k -k here to ensure we keep the pack fetched as we're only fetching 6 objects and they are already reachable in the quickclone repository thanks to the alternate ODB. If we use unpack-objects during this fetch we will still pass this test because the objects won't be unpacked if they are already reachable locally.
Of course this test is for a performance optimization. For 6 tiny objects it really doesn't matter if we copy them or not, or if we copy them over a pipe only to discard them because they are already reachable. It does however matter when you are talking about nearly 300MB worth of objects. :-\
-- Shawn.