From: Jonathan Nieder Date: Fri, 24 Sep 2010 06:59:00 GMT Subject: [PATCH/RFC 00/24] Re: [PATCH 1/3] t9300 (fast-import): style tweaks Message-ID: <20100924065900.GA4666@burratino> In-Reply-To: <20100905032253.GB2344@burratino> Hi, Jonathan Nieder wrote: > Clarify dependencies between tests to make the fast-import test > script more approachable. In particular: ... many things ... > While at it: ... more things ... The patch was a lazy way for me to add new assertions to the fast-import test script without going crazy. But it really was lazy: it has almost nothing to do with the "fast-import protocol experiments" series that it headed, and worse, that one patch did so many things at once that it was basically guaranteed that (1) no one would like all of it and (2) it bitrotted in a couple of days. Oh well. Tomorrow I would like to re-roll the fast-import experiment so the svn-fe that understands deltas can get more attention, and of course that series does not require these style fixes at all. So why resend them? I end up mentally making these changes every time I add a new test to that script, so I imagine it would be nicer to make the changes once. Maybe it would help newcomers to dive into the wonderful world of fast-import testing. So here is a small chunk of that monster patch, ejected from the original series and split up. Patch 1 introduces a verify_packs () helper that makes the script much easier to read (by including only two copies of an unpleasant loop). The nominal justification is that giving the for each pack do git verify-pack $pack || exit done loop its own function allows use to write "return" instead of "exit", resulting in better behavior when a test fails. Patch 2 is the most important one to me. It gets rid of some hardcoded tree and blob names, most of which were not doing any harm except to scare me. At first glance it is not obvious when a stray test_tick, for example, will ruin later tests (it turns out never but there is at one test that does depend on the choice of hash function), and at first glance, it is not obvious what is actually the expected diff when a raw diff is presented as expected output. The approach adopted is to introduce some symbolic constants, like empty_blob=$(git hash-object --stdin