Re: [PATCH 14/15] [GSOC] cat-file: re-implement --textconv, --filters options
- From
ZheNing Hu <adlternative@gmail.com>
- Date
- Jul 3, 2021, 06:17 UTC
- Message-ID
- <CAOLTT8S4XnekSCAFNgPeQZD7JU2p3bm==9vHRDxcir-K+w4rqA@mail.gmail.com>
- In-Reply-To
- <xmqqy2aopwg2.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年7月2日周五 下午11:27写道:
Show 17 quoted lines
> > ZheNing Hu <adlternative@gmail.com> writes: > > >> These global variables are problematic. The places that check them > >> are quite isolated, and it makes me wonder why we cannot pass a > >> format instance through the callchain down to get_object(). > > > > If we pass such two options In such a deep call chain, it seems not > > worth to do it. > > OK. After all, ref-filter.c has too many existing global variables > (starting from the used_atom[] array) that makes it impossible to be > a proper API that can be used to handle more than one invocations at > once, so two more globals aren't making it any more hopeless than it > currently is. If we wanted to make the API reentrant, we'd need a > bigger change anyway. >
Yes, Using global variables may make the code non-reentrant. Now I think because the "rest" is already in struct ref_array_item, we can emulate "rest", adding these two flags "use_textconv" and "use_filter" to struct ref_array_item. Then we can use them in get_object().
Show 5 quoted lines
> > Or just use "static" prefix? > > Yes, that is needed regardless to pass "make sparse". > > TShanks.
Thanks. -- ZheNIng Hu