bundle-uri: drain remaining response on invalid bundle-uri lines
On clone, when the client sends the `bundle-uri` command, the server might respond with invalid data. For example if it sends information about a bundle where the 'uri' is empty, it produces the following error: Cloning into 'foo'... error: bundle-uri: line has empty key or value error: error on bundle-uri response line 4: bundle.bundle-1.uri= error: could not retrieve server-advertised bundle-uri list This error is bubbled up to `transport_get_remote_bundle_uri()`, which is called by `cmd_clone()` in builtin/clone.c. Over here, the return value is ignored, so clone continues. Despite this, it still dies with this error: fatal: expected 'packfile' This happens because `get_remote_bundle_uri()` exited early, leaving some unprocessed packet data behind in the read buffer. This is misleading to the user, because it suggests a problem with the packfile exchange, when in reality it's caused by a misconfigured bundle-URI on the server-side. Fix this by continuing to read packets when an error was encountered, but without processing the remaining lines. This drains the protocol stream so no stale data is left behind and the caller can use it if they like. With this, clone now continues successfully if invalid bundle-URI data was sent by the server. This is intentional, because since the inception of `transport_get_remote_bundle_uri()` in 0cfde740f0 (clone: request the 'bundle-uri' command when available, 2022-12-22) the return value of that function is ignored in `cmd_clone()` so the clone can continue without bundles. Signed-off-by: Toon Claes <toon@iotcl.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>