Jeff King <peff@xxxxxxxx> 于2021年6月1日周二 上午9:49写道: > > Or we could just generate the entire expected output and check it with > "cmp". The most robust way is probably to loop over the objects, running > "git cat-file" for each, but that's slow. Maybe: > > git cat-file --batch-all-objects --batch-check='%(objectname)' >objects && > git cat-file --batch='%(objectname)' <objects >expect && > git cat-file --batch-all-objects --batch='%(objectname)' >actual && > # not test_cmp, as it is not binary clean! > cmp expect actual > > That feels a bit circular in that it's mostly just exercising most of > the same code in the "expect" and "actual" paths. The interesting part > is the combination of the two options, which is why I think that just > making sure we don't hit an error might be enough. > Such a test is also acceptable. I will add a test like this. > -Peff -- ZheNing Hu