threads / rfc / 50868

[GSoC] [RFC] Unify ref-filter formats with other --pretty formats

Subject: [GSoC] [RFC] Unify ref-filter formats with other --pretty formats

## tl;dr

2 messages between Apr 3, 2019 and Apr 4, 2019.

replies: 1people: 2as markdown or json

Kapil Jain· Apr 3, 2019, 19:54 UTC · lore
Reference: https://git.github.io/SoC-2019-Ideas/#unify-ref-filter-formats-with-other---pretty-formats
I have spent some time with both pretty.* and ref-filter.*

First off, we are aiming to reuse ref-filter, so avoiding any sort of re-implementation is recommended.

Now, coming to pretty.* and ref-filter.*

suppose, a function named xyz() in ref-filter.c seems like it could be reused in pretty.c. since ref-filter doesn't use any struct of pretty.c. The xyz() function in its original form is not useful for pretty.c. So now, in order for the xyz() function to be useful in pretty.c. Function xyz() should be using structs of pretty.*

now, if we make xyz() use the pretty.* structs, then its re-implementation and not reusing. its like keeping two different functions one for ref-filter and another for pretty.*. which is what is already happening.

please provide any starting point for reusing ref-filter. i don't see any in pretty.*. reusing ref-filter specifically in pretty.* is not the motive. please point out any file in entire code base, that you may feel can reuse some ref-filter logic.

Olga Telezhnaya· Apr 4, 2019, 12:02 UTC · re: Kapil Jain · lore

Re: [GSoC] [RFC] Unify ref-filter formats with other --pretty formats

ср, 3 апр. 2019 г. в 22:54, Kapil Jain <jkapil.cs@gmail.com>:
Show 7 quoted lines
>
> Reference: https://git.github.io/SoC-2019-Ideas/#unify-ref-filter-formats-with-other---pretty-formats
>
> I have spent some time with both pretty.* and ref-filter.*
>
> First off, we are aiming to reuse ref-filter, so avoiding any sort of
> re-implementation is recommended.

It is recommended, but it's normal situation to re-implement something as a middle step.

Show 14 quoted lines
>
> Now, coming to pretty.* and ref-filter.*
>
> suppose, a function named xyz() in ref-filter.c seems like it could be
> reused in pretty.c.
> since ref-filter doesn't use any struct of pretty.c. The xyz()
> function in its original form is not useful for pretty.c.
> So now, in order for the xyz() function to be useful in pretty.c.
> Function xyz() should be using structs of pretty.*
>
> now, if we make xyz() use the pretty.* structs, then its
> re-implementation and not reusing. its like keeping two different
> functions one for ref-filter and another for pretty.*.
> which is what is already happening.

It's OK as the middle step. Another approach is to add using ref-filter structures and continue using existing ones, so that you have 2 duplicating flows of data. Reuse ref-filter logic, and then in the end of the patch delete duplicating logic from pretty. Both these approaches could be useful, choose any of them or design your own way. I deleted so much code that I wrote, I advice you try not to afraid of it. It's OK to make something and then rewrite it several times. The only thing that matters is the final result.

Show 6 quoted lines
>
> please provide any starting point for reusing ref-filter. i don't see
> any in pretty.*.
> reusing ref-filter specifically in pretty.* is not the motive. please
> point out any file in entire code base, that you may feel can reuse
> some ref-filter logic.

← back to recent threads