Re: [PATCH 0/4] for-each-ref: introduce seeking functionality via '--skip-until'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Karthik Nayak <karthik.188@xxxxxxxxx> writes:
>
>> The `git-for-each-ref(1)` command is used to iterate over references
>> present in a repository. In large repositories with millions of
>> references, it would be optimal to paginate this output such that we
>> can start iteration from a given reference.
>
> I haven't looked at the patches, but should the end-user's mental
> model of the process be like this?
>
>  - We have a native order in which references are sorted and that is
>    what "git for-each-ref" without "--sort" option gives them.
>
>  - They can use the "--skip-until" option to seek in the above order
>    and start iterating in the middle.
>
>  - If they give "--sort", the set of refs to be shown would not
>    change; skipping is done in the native order and then the
>    remainder is given sorted.
>
> Please make sure that the documentation is clear enough to avoid a
> misunderstanding that this feature would kick in after we grab all
> refs and sort them.  If it worked that way, it would allow us to say
> "going from newer to older, but skipping the most recent ones that
> were touched within a week", which would have been nice, but that is
> not what we are doing with this feature---I think it is OK but we
> need to be clear about it in the documentation.
>

I totally didn't consider '--sort'. I do agree that we should document
that behavior if we tend to keep it as is. I wonder if it is worthwhile
to even prevent the two from being used together. I find the whole "we
skip before sorting" to be very confusing.

>> This series adds a '--skip-until' option in 'git-for-each-ref(1)'. When
>> used, the reference iteration seeks to the first matching reference and
>> iterates from there onward.
>
> OK.  Even the filesystem backed ones we internall sort after doing
> readdir() loop, so this is feasible.  Nice.
>

Yup. We have 'sort_ref_dir()' to sort each directory parsed.

>> Initally I was also planning to cleanup all the `refs_for_each...()`
>> functions in 'refs.h' by simply using the iterator, but this bloated the
>> series. So I've left that for another day.
>
> OK.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux