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

Re: [GSoC][PATCH 2/2] clone: use dir-iterator to avoid explicit dir traversal

From
Matheus Tavares Bernardino <matheus.bernardino@usp.br>
Date
Feb 21, 2019, 04:46 UTC
Message-ID
<CAHd-oW6VPrHMo1QjAXn6G8P_gmJOQ91LVO+UDK1a8T7uhuM9uQ@mail.gmail.com>
In-Reply-To
<20190219234506.GL6085@hank.intra.tgummerer.com>

Ok, I think I'm almost there and I should be able to send a v2 on the weekend. But again, a few questions arose while I'm coding v2. Please, see inline.

On Tue, Feb 19, 2019 at 8:45 PM Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 8 quoted lines
>
> On 02/19, Matheus Tavares Bernardino wrote:
> > Ok, I agree. I noticed copy_or_link_directory only skips hidden
> > directories, not hidden files. And I couldn't think why we would want
> > to skip one but not the other... Could that be unintentional? I mean,
> > maybe the idea was to skip just "." and ".."? If that is the case, I
> > don't even need to make an if check at copy_or_link_directory, since
> > dir-iterator already skips "." and "..". What do you think about that?
[...]
Show 9 quoted lines
> I feel like you are probably right in that it could be unintentional,
> and I don't think anyone should be messing with the objects
> directory.  However that is no guarantee that changing this wouldn't
> break *something*.
>
> For the purpose of this change I would try to keep the same behaviour
> as we currently have where possible, to not increase the scope too
> much.
>

I understand your point, but to make copy_or_link_directory() skip just hidden directories using dir-iterator seems, now, a little tricker than I though before. The "if (iter->basename[0] != '.')" statement in the patch I sent for v1 only skips the hidden directories creation, but it does not avoid the attempt to copy the hidden directory contents (which would obviously fail). If we were to do that, we would need to check every directory in the relative path string of each iteration entry looking for a hidden directory. That seems a little too much, IMHO. Because of that and the intuition that skipping over hidden dirs was an unintentional operation, I think we could modify copy_or_link_directory() to skip '.' and '..', only. Also, hidden dirs/files are not expected to be at .git/objects anyway, are they?

And to have copy_or_link_directory()'s behaviour changed as little as possible, I could add the option to not follow hidden paths (dirs and regular files) at dir-iterator.c and use it at copy_or_link_directory() (now that I'm adding the 'pedantic' option, this won't be so difficult, anyway). Would these suggestions be a good plan?

Thanks, Matheus Tavares

Previous: Thomas GummererNext: Thomas Gummerer
Message 12 of 14 in “clone: convert explicit traversal to”
  1. Matheus TavaresFeb 15, 2019
  2. [GSoC][PATCH 1/2] clone: extract function from copy_or_link_directoryMatheus Tavares, Feb 15, 2019
  3. Christian CouderFeb 16, 2019
  4. Matheus Tavares BernardinoFeb 18, 2019
  5. [GSoC][PATCH 2/2] clone: use dir-iterator to avoid explicit dir traversalMatheus Tavares, Feb 15, 2019
  6. Christian CouderFeb 16, 2019
  7. Thomas GummererFeb 16, 2019
  8. Matheus Tavares BernardinoFeb 18, 2019
  9. Thomas GummererFeb 18, 2019
  10. Matheus Tavares BernardinoFeb 19, 2019
  11. Thomas GummererFeb 19, 2019
  12. Matheus Tavares BernardinoFeb 21, 2019
  13. Thomas GummererFeb 21, 2019
  14. Daniel Ferreira (theiostream)Feb 22, 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.