git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
KJKapil Jain <jkapil.cs@gmail.com>
Date
Mar 27, 2019, 17:01 UTC
Message-ID
<CAMknYENndiGBkC75aaYwWQZ0rkR5Nn=2L8f-PTzBNOXmhhHWZA@mail.gmail.com>
In-Reply-To
<CAL21Bmn0BQirS=vyTRHBx_kfuEp1JY4uw2wkjm5w_pgwgjA5iA@mail.gmail.com>
Show 7 quoted lines
> On Tue, Mar 26, 2019 at 2:48 AM Olga Telezhnaya <olyatelezhnaya@gmail.com> wrote:
>> Kapil Jain <jkapil.cs@gmail.com> wrote:
> > Now, the verify_ref_format function can be used inside
> > get_commit_format function, hence reusing logic.
> > Is this a correct example to work on, for this project ?
>
> Hi! Yes, in my opinion your example looks like good starting point.

I read through the code of both functions, and I think they are different. Please point out if I missed to see the similarity.

or may be it seemed that way, because they both deal with different formats. So, first should a translating function (pretty to ref-filter) be written ?

Show 5 quoted lines
> > Other than this I can't find any other example, for this project in
> > pretty.* and ref-filter.*
> > Perhaps some examples could be found in command specific files, right ?
>
> Other parts of the project are about reusing other ref-filter logic.

So, the project is not limited to reusing ref-filter logics in pretty, it is about reusing ref-filter logic wherever possible, right ?

> For example, we could try to reuse format_ref_array_item() from
> ref-filter.h.
where can format_ref_array_item() be reused ?
Show 6 quoted lines
> I haven't dig into pretty.c logic much, but I guess it
> is possible to translate "pretty" formatting commands to ref-filter
> ones. That will allow us to remove similar logic from pretty.c. Our
> final goal is to minimise code duplication and to have one unified
> interface to extract all needed data from object and to print it
> properly.

I looked, and yes some, but not all pretty formats are translatable. For example: %GP, %p, %P. are not translatable to ref-filter. or is there a workaround to translate them ?

It looks like to reuse ref-filter logic, a translator from pretty to ref-filter needs to be built. So, building a translator would be a starting point ? and then second step would be to recognise places where ref-filter can be reused, right ?

Show 9 quoted lines
> > what is atom ? is it a piece of a whole document ? and what is meant
> > by used atoms ?
>
> I had the same question in my beginning. Please have a look at [1].
> Another good question - what is object. You could ensure that you
> understand this by reading [2].
>
> [1] https://git-scm.com/docs/git-for-each-ref#_field_names
> [2] https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
Thanks, this helped.
Previous: Olga TelezhnayaNext: Olga Telezhnaya
Message 3 of 9 in “[GSoC] Unify ref-filter formats with other --pretty formats”
  1. Kapil JainMar 25, 2019
  2. Olga TelezhnayaMar 25, 2019
  3. Kapil JainMar 27, 2019
  4. Olga TelezhnayaMar 28, 2019
  5. Kapil JainMar 29, 2019
  6. Kapil JainMar 31, 2019
  7. Thomas GummererMar 31, 2019
  8. Kapil JainApr 1, 2019
  9. Olga TelezhnayaMar 31, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.