> > `rest`:: > > If this atom is used in the output string, input lines are split > > Why not forbidden %(rest) here too? Good catch. This should definitely be forbidden. I thought at first this was inconsequential, but since I also have remote as part of the input, this would no longer hold true. > > + if (strstr(format, "%(objectsize:disk)")) > > + die(_("objectsize:disk is currently not supported with remote-object-info")); > > + if (strstr(format, "%(deltabase)")) > > + die(_("deltabase is currently not supported with remote-object-info")); > > %(rest) too? ditto > Maybe such code style will be better? > > if (!gtransport->smart_options) { > return -1; > } > ... > return transport_fetch_refs(gtransport, NULL); That does look better! > > - cmd->fn(opt, p, output, data); > > + if (!strcmp(cmd->name, "remote-object-info")) { > > + char *line = xstrdup_or_null(p); > > + parse_remote_info(opt, line, output, data, cmd, NULL); > > memory leak: "line". ack > > +test_expect_success 'remote-object-info fails on unspported filter option (deltabase)' ' > > + ( > > + cd "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" && > > + > > + test_must_fail git cat-file --batch-command="%(deltabase)" 2>err <<-EOF && > > + remote-object-info "$HTTPD_URL/smart/http_parent" $hello_sha1 > > + EOF > > + test_i18ngrep "deltabase is currently not supported with remote-object-info" err > > + ) > > +' > > + > > %(rest) too? ditto > > +test_expect_success 'batch-command remote-object-info file://' ' > > + ( > > + cd server && > > + > > + echo "$hello_sha1 $hello_size" >expect && > > + echo "$tree_sha1 $tree_size" >>expect && > > + echo "$commit_sha1 $commit_size" >>expect && > > + echo "$tag_sha1 $tag_size" >>expect && > > + git cat-file --batch-command="%(objectname) %(objectsize)" >actual <<-EOF && > > + remote-object-info "file://$(pwd)" $hello_sha1 > > + remote-object-info "file://$(pwd)" $tree_sha1 > > + remote-object-info "file://$(pwd)" $commit_sha1 > > + remote-object-info "file://$(pwd)" $tag_sha1 > > + EOF > > + test_cmp expect actual > > + ) > > Can we support <rev> instead of only <oid> here? Not at the current moment. The server is unable to handle anything besides oids. > > $ git cat-file --batch-check > HEAD > 28583b8d8ca72730d7c9e0ea50861ad431a6dea4 commit 3038 > master > ab336e8f1c8009c8b1aab8deb592148e69217085 commit 281 > origin/master > 23b219f8e3f2adfb0441e135f0a880e6124f766c commit 282 > origin/master:git.c > e5d62fa5a92e95e1ede041ebf913d841744c31f8 blob 28398 > > So cat-file --batch-check can support it. > > $git cat-file --batch-commands > remote-object-info "file://$(pwd)" master:git.c > > I guess it cannot work now, right? Correct.