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

2 messages from 2019-04-03 to 2019-04-04. Participants: Kapil Jain, Olga Telezhnaya.
Thread: https://gitlist.dev/t/50868

## Kapil Jain, 2019-04-03 19:54

Subject: [GSoC] [RFC] Unify ref-filter formats with other --pretty formats
Message-ID: <CAMknYEPzUpa3c9PSfJNo6rzUOt-bDUDYrcn9JcHgSGW43KuRYg@mail.gmail.com>
URL: https://gitlist.dev/e/CAMknYEPzUpa3c9PSfJNo6rzUOt-bDUDYrcn9JcHgSGW43KuRYg%40mail.gmail.com

```
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, 2019-04-04 12:02

Subject: Re: [GSoC] [RFC] Unify ref-filter formats with other --pretty formats
Message-ID: <CAL21Bmnm0Pk9mHzetSx0_GDcUc0SJZ5giWoFUdTMLCZ+KutEVQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAL21Bmnm0Pk9mHzetSx0_GDcUc0SJZ5giWoFUdTMLCZ%2BKutEVQ%40mail.gmail.com
In-Reply-To: <CAMknYEPzUpa3c9PSfJNo6rzUOt-bDUDYrcn9JcHgSGW43KuRYg@mail.gmail.com>

```
ср, 3 апр. 2019 г. в 22:54, Kapil Jain <jkapil.cs@gmail.com>:
>
> 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.

>
> 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.

>
> 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.

```
