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

Re: [PATCH 2/4] ref-filter: add ref-filter API

From
karthik nayak <karthik.188@gmail.com>
Date
May 21, 2015, 17:30 UTC
Message-ID
<555E161C.1080504@gmail.com>
In-Reply-To
<CAPig+cTiYk_oGj98QttMMDjyJDFV256yOwu9b8_znOMnaMt7-A@mail.gmail.com>
On 05/21/2015 12:37 AM, Eric Sunshine wrote:
Show 31 quoted lines
> On Wed, May 20, 2015 at 9:18 AM, Karthik Nayak <karthik.188@gmail.com> wrote:
>> add a ref-filter API to provide functions to filter refs for listing.
>> This will act as a common library for commands like 'tag -l',
>> 'branch -l' and 'for-each-ref'. ref-filter will enable each of these
>> commands to benefit from the features of the others.
>>
>> Mentored-by: Christian Couder <christian.couder@gmail.com>
>> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
>> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
>> ---
>>   Makefile     |  1 +
>>   ref-filter.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   ref-filter.h | 47 ++++++++++++++++++++++++++++++++++++++
>>   3 files changed, 121 insertions(+)
>>   create mode 100644 ref-filter.c
>>   create mode 100644 ref-filter.h
>
> A shortcoming of this approach is that it's not blame-friendly.
> Although those of us following this patch series know that much of the
> code in this patch was copied from for-each-ref.c, git-blame will not
> recognize this unless invoked in the very expensive "git blame -C -C
> -C" fashion (if I understand correctly). The most blame-friendly way
> to perform this re-organization is to have the code relocation (line
> removals and line additions) occur in one patch.
>
> There are multiple ways you could arrange to do so. One would be to
> first have a patch which introduces just a skeleton of the intended
> API, with do-nothing function implementations. A subsequent patch
> would then relocate the code from for-each-ref.c to ref-filter.c, and
> update for-each-ref.c to call into the new (now fleshed-out) API.
>

Did you read Junio's suggestion on how I should re-order this WIP patch series ? That's somewhat on the lines of what you're suggesting. I'll probably be going ahead with that, not really sure about how blame works entirely so what do you think about that?

Previous: Eric SunshineNext: Eric Sunshine
Message 7 of 24 in “Unifying git branch -l, git tag -l, and git for-each-ref”
  1. karthik nayakMay 20, 2015
  2. 1/4 for-each-ref: rename refinfo members to match similar structuresKarthik Nayak, May 20, 2015
  3. Matthieu MoyMay 20, 2015
  4. karthik nayakMay 21, 2015
  5. 2/4 ref-filter: add ref-filter APIKarthik Nayak, May 20, 2015
  6. Eric SunshineMay 20, 2015
  7. karthik nayakMay 21, 2015
  8. Eric SunshineMay 21, 2015
  9. karthik nayakMay 22, 2015
  10. Matthieu MoyMay 21, 2015
  11. karthik nayakMay 21, 2015
  12. karthik nayakMay 21, 2015
  13. Matthieu MoyMay 22, 2015
  14. karthik nayakMay 22, 2015
  15. Matthieu MoyMay 23, 2015
  16. Christian CouderMay 23, 2015
  17. Matthieu MoyMay 23, 2015
  18. Junio C HamanoMay 23, 2015
  19. Matthieu MoyMay 23, 2015
  20. Karthik NayakMay 23, 2015
  21. 3/4 for-each-ref: convert to ref-filterKarthik Nayak, May 20, 2015
  22. Junio C HamanoMay 20, 2015
  23. karthik nayakMay 21, 2015
  24. 4/4 ref-filter: move formatting/sorting options from 'for-each-ref'Karthik Nayak, May 20, 2015

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.