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

Re: [PATCH 01/10] ref-filter: add option to filter only branches

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2015, 15:56 UTC
Message-ID
<xmqq614hkgnd.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAOLa=ZQSVCgcuUQFsF2Mq-m+wS8im3t4Z3PSEgoAHcV0gGuvPA@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 23 quoted lines
> On Thu, Aug 13, 2015 at 5:05 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
>> On Thu, Aug 13, 2015 at 4:21 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
>>>
>>> This was taken from branch.c, I thought of using an enum instead but that
>>> would again require most of branch.c, hence it's been carried over
>>> without changing
>>> I'm thinking of changing it, any suggestions?
>>>
>>
>> What I was thinking was of having:
>>
>> #define FILTER_REFS_INCLUDE_BROKEN 0x1
>> #define FILTER_REFS_TAGS 0x2
>> #define FILTER_REFS_BRANCHES 0x4
>> #define FILTER_REFS_REMOTES 0x8
>> #define FILTER_REFS_DETACHED_HEAD 0x16
>>
>> and using these for showing ref kind also instead of separately
>> having 'REF_DETACHED_HEAD' and so on.
>>
>
> Something like this:
> https://github.com/KarthikNayak/git/commit/0ec5381420dcdfe7c62000b56168e2842d5d0063

I notice a few things in ref-filter.c in that commit (a web interface including GitHub one is horrible in showing the things in wider context across files, so I'll base my discussion by guessing what the caller of this function and helpers this function calls do):

 - Your "ALL" silently overrides others.  Is that sensible?  Perhaps
   you would instead want to define FILTER_REFS_OTHER (not needed to
   be exposed to UI) and then define FILTER_REFS_ALL as the ORed
   value of FILTER_REFS_{BRANCHES,...,OTHER}?
 - When the caller asks for "--branches --tags", you run
   ref-filter-handler twice on ref_cbdata.  Does that make sense?
   Shouldn't you iterate over all the available refs just once,
   rejecting ones that aren't in either refs/{heads,tags}/ instead?
Previous: Karthik NayakNext: Karthik Nayak
Message 7 of 27 in “Port branch.c to ref-filter.”
  1. 0/10 Port branch.c to ref-filter.Karthik Nayak, Aug 4, 2015
  2. 01/10 ref-filter: add option to filter only branchesKarthik Nayak, Aug 4, 2015
  3. Junio C HamanoAug 11, 2015
  4. Karthik NayakAug 13, 2015
  5. Karthik NayakAug 13, 2015
  6. Karthik NayakAug 13, 2015
  7. Junio C HamanoAug 14, 2015
  8. Karthik NayakAug 14, 2015
  9. Matthieu MoyAug 13, 2015
  10. Karthik NayakAug 13, 2015
  11. 02/10 branch: refactor width computationKarthik Nayak, Aug 4, 2015
  12. Eric SunshineAug 11, 2015
  13. Karthik NayakAug 11, 2015
  14. 03/10 branch: bump get_head_description() to the topKarthik Nayak, Aug 4, 2015
  15. Eric SunshineAug 11, 2015
  16. Karthik NayakAug 11, 2015
  17. 04/10 branch: roll show_detached HEAD into regular ref_listKarthik Nayak, Aug 4, 2015
  18. Eric SunshineAug 11, 2015
  19. Karthik NayakAug 11, 2015
  20. 05/10 branch: move 'current' check down to the presentation layerKarthik Nayak, Aug 4, 2015
  21. 06/10 branch: drop non-commit error reportingKarthik Nayak, Aug 4, 2015
  22. 07/10 branch.c: use 'ref-filter' data structuresKarthik Nayak, Aug 4, 2015
  23. 08/10 branch.c: use 'ref-filter' APIsKarthik Nayak, Aug 4, 2015
  24. 09/10 branch: add '--points-at' optionKarthik Nayak, Aug 4, 2015
  25. Karthik NayakAug 4, 2015
  26. Junio C HamanoAug 5, 2015
  27. Karthik NayakAug 7, 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.