Re: [PATCH v4 6/6] cat-file: add remote-object-info to batch-command
- From
karthik nayak <karthik.188@gmail.com>
- Date
- Oct 25, 2024, 10:53 UTC
- Message-ID
- <CAOLa=ZSVxOoS0iQ0Ku1LF2jwSw2uK8DMjFJYL77Bto98_sKMUg@mail.gmail.com>
- In-Reply-To
- <20241024205359.16376-7-eric.peijian@gmail.com>
Eric Ju <eric.peijian@gmail.com> writes:
[snip]
Show 10 quoted lines
> @@ -314,7 +323,10 @@ newline. The available atoms are: > line) are output in place of the `%(rest)` atom. > > If no format is specified, the default format is `%(objectname) > -%(objecttype) %(objectsize)`. > +%(objecttype) %(objectsize)`, except for `remote-object-info` commands which use > +`%(objectname) %(objectsize)` for now because "%(objecttype)" is not supported yet. > +WARNING: When "%(objecttype)" is supported, the default format WILL be unified, so > +DO NOT RELY on the current the default format to stay the same!!! >
This seems like a planned breakage, wouldn't it make more sense to implement %(objecttype) first?
Show 33 quoted lines
> diff --git a/builtin/cat-file.c b/builtin/cat-file.c
> index 5db55fabc4..714c182f39 100644
> --- a/builtin/cat-file.c
> +++ b/builtin/cat-file.c
> @@ -24,6 +24,9 @@
> #include "promisor-remote.h"
> #include "mailmap.h"
> #include "write-or-die.h"
> +#include "alias.h"
> +#include "remote.h"
> +#include "transport.h"
>
> enum batch_mode {
> BATCH_MODE_CONTENTS,
> @@ -42,9 +45,12 @@ struct batch_options {
> char input_delim;
> char output_delim;
> const char *format;
> + int use_remote_info;
> };
>
> static const char *force_path;
> +static struct object_info *remote_object_info;
> +static struct oid_array object_info_oids = OID_ARRAY_INIT;
>
> static struct string_list mailmap = STRING_LIST_INIT_NODUP;
> static int use_mailmap;
> @@ -528,7 +534,7 @@ static void batch_one_object(const char *obj_name,
> enum get_oid_result result;
>
> result = get_oid_with_context(the_repository, obj_name,
> - flags, &data->oid, &ctx);
> + flags, &data->oid, &ctx);Nit: we usually don't fix parts of code, which we're not explicitly modifying.
[snip]