All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: "Daniel Ferreira (theiostream)" <bnmvco@gmail.com>
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
	Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>,
	Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH v4 2/5] dir_iterator: iterate over dir after its contents
Date: Wed, 5 Apr 2017 16:21:45 +0700	[thread overview]
Message-ID: <CACsJy8BTKHZqsJfbvmi9YgeaDyHK6wjBLf9dkBXfbZ=BRMa=pA@mail.gmail.com> (raw)
In-Reply-To: <CAEA2_RKFwL8K=-QBYbmfbjJ44obB+PJit0pd5im0Jy_=E_-+MA@mail.gmail.com>

On Sun, Apr 2, 2017 at 11:25 AM, Daniel Ferreira (theiostream)
<bnmvco@gmail.com> wrote:
> Why exactly would it not be applicable to read_directory_recursively()?

Because that function is a beast (and probably should have "beast" in
the function name).

The function is supposed to read .gitignore, index file and whatever
else needed, traverse the directory and return the list of untracked
files, or ignored files. It even has options to return a directory
path, if all entries inside is ignored/untracked, instead of the list
of files inside. On top of that, it has "untracked cache" to skip
traversing directories to speed up.

Using dir_iterator might be possible but we'll need to improve it a
lot. read_directory_recursively() needs really fine control over
traversing: it can decide to not recurse in a subdirectory, it can
decide to ignore the rest of the entries in a directory and go back to
its parent, and in the case of untracked cache, it can switch to
traversing the cache instead of on-disk directories.

It's possible, probably, but it's going to need quite a lot of work
(and care, since I think there are corner cases that have been abused
in real world and we just cannot change those behaviors). Using
iterator interface would be a good improvement to clean up the "on
disk or on cache" directory traversal there though.

>
> On Thu, Mar 30, 2017 at 8:08 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Thu, Mar 30, 2017 at 1:39 PM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>> * DIR_ITERATOR_RECURSE -- recurse into subdirectories
>>>
>>> would make the set of possible options complete. If this option is not
>>> set, then the iteration would be over the entries in a single directory
>>> without traversing its subdirectories.
>>
>> And would make it possible to use dir-iterator everywhere (except
>> read_directory_recursiveky). That would be really nice :)
>> --
>> Duy



-- 
Duy

  reply	other threads:[~2017-04-05  9:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  0:32 [PATCH v4 0/5] [GSoC] remove_subtree(): reimplement using iterators Daniel Ferreira
2017-03-29  0:32 ` [PATCH v4 1/5] dir_iterator: add helpers to dir_iterator_advance Daniel Ferreira
2017-03-29  4:32   ` Michael Haggerty
2017-03-29  0:32 ` [PATCH v4 2/5] dir_iterator: iterate over dir after its contents Daniel Ferreira
2017-03-29  9:56   ` Michael Haggerty
2017-03-29 10:44     ` Michael Haggerty
2017-03-29 16:46     ` Junio C Hamano
2017-03-30  4:59       ` Michael Haggerty
2017-03-30  6:08         ` Junio C Hamano
2017-03-30  6:39           ` Michael Haggerty
2017-03-30 11:08             ` Duy Nguyen
2017-04-02  4:25               ` Daniel Ferreira (theiostream)
2017-04-05  9:21                 ` Duy Nguyen [this message]
2017-03-30 17:26             ` Junio C Hamano
2017-03-29  0:32 ` [PATCH v4 3/5] remove_subtree(): reimplement using iterators Daniel Ferreira
2017-03-29 10:01   ` Michael Haggerty
2017-03-29  0:32 ` [PATCH v4 4/5] remove_subtree(): test removing nested directories Daniel Ferreira
2017-03-29  0:32 ` [PATCH v4 5/5] files_reflog_iterator: amend use of dir_iterator Daniel Ferreira
2017-03-29 10:45   ` Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACsJy8BTKHZqsJfbvmi9YgeaDyHK6wjBLf9dkBXfbZ=BRMa=pA@mail.gmail.com' \
    --to=pclouds@gmail.com \
    --cc=bnmvco@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.