Re: [PATCH/WIP 02/11] notes-merge: use opendir/readdir instead of using read_directory()
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Oct 26, 2011, 00:08 UTC
- Message-ID
- <CACsJy8CocoAiVx_PeaaX1oRZvmzfj9-z9JLJkE5unSRVtpGkNA@mail.gmail.com>
- In-Reply-To
- <7vzkgo3m9b.fsf@alter.siamese.dyndns.org>
2011/10/26 Junio C Hamano <gitster@pobox.com>:
Show 11 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes: > >> notes_merge_commit() only needs to list all entries (non-recursively) >> under a directory, which can be easily accomplished with >> opendir/readdir and would be more lightweight than read_directory(). >> >> read_directory() is designed to list paths inside a working >> directory. Using it outside of its scope may lead to undesired effects. > > Technically isn't the directory structure this codepath looks at a working > tree that has extract of a notes tree commit?
Yes it's like a secondary working tree, only for notes, if I read the code correctly. The thing is this space is inside ".git".
Current read_directory() treats given path separately from contents inside the path. If the given path has ".git", it's ok (but it'll stop at .git if during tree recursion). The new read_directory() does not make this exception, so when note-merge call read_directory(".git/NOTES_MERGE_WORKTREE"), read_directory() sees ".git" and stops immediately, assuming it's a gitlink.
One could say we should keep current behavior, but I don't really see it's worth the effort.
-- Duy