Re: [PATCH v3 31/39] bundle: add new version for use with SHA-256
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 23, 2020, 05:40 UTC
- Message-ID
- <CAPig+cTPbu9NgJCqKEY9-qRrJYGPxBFb-acS=v72jC6GKEY-LQ@mail.gmail.com>
- In-Reply-To
- <CAPig+cRWptYRJUpT71jW6_O9UZ1RK=FCbZj-+OkR_5kGqSWScg@mail.gmail.com>
On Thu, Jul 23, 2020 at 1:31 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Wed, Jul 22, 2020 at 9:10 PM brian m. carlson > <sandals@crustytoothpaste.net> wrote: > > +test_expect_success 'git bundle v3 rejects unknown extensions' '
By the way, should this be s/extensions/capabilities/ ?
Show 8 quoted lines
> > + head -n2 bundle >new && > > + echo "@unknown=silly" >>new && > > + sed "1,2d" bundle >>new && > > + test_must_fail git bundle verify new 2>output && > > + test_i18ngrep "unknown capability .unknown=silly." output > > +' > > I worry about passing binary bundle data through 'sed' like this.
Thinking on this further: Since you are only interested in whether or not "git bundle verify" correctly complains about the unknown capabilities, you really don't even need any of the binary bundle data which follows the header. As such, you could just hand-craft the bogus bundle, perhaps like this:
cat >new <<\-EOF &&
# v3 git bundle
@object-format=sha256
@unknown=silly
EOF
test_must_fail git bundle verify new 2>output &&
test_i18ngrep "unknown capability .unknown=silly." output