Re: [PATCH 10/32] rev-list: support traversing in narrow repository mode
- From
Elijah Newren <newren@gmail.com>
- Date
- Aug 25, 2010, 04:11 UTC
- Message-ID
- <AANLkTimmd-6CWEA9qjHGnAn8svjU+iEFDxwbck6KAQtX@mail.gmail.com>
- In-Reply-To
- <1282688422-7738-11-git-send-email-pclouds@gmail.com>
2010/8/24 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
> In this mode, only trees within revs->narrow_prefix is traversed. This > narrows down the whole repository to the given subtree. This mode will > be used by upload-pack/pack-objects to create a narrow pack, and by > all git operations in narrow repository (i.e. $GIT_DIR/narrow exists).
My fix-rev-list series I posted is going to cause a few conflicts with this patch...
<snip>
Show 6 quoted lines
> + if (!subtree) > + ; /* no subtree restriction, go on */ > + else if (S_ISDIR(entry.mode) && > + !strncmp(entry.path, subtree, subtree_len) && > + entry.path[subtree_len] == '\0') > + ; /* inside subtree, go on */
Instead of writing your own comparison code, you may want to consider using tree_entry_interesting() here. That would also provide you with a natural extension to multiple subtrees, rather than your currently hardcoded single tree. You may want to take a look at tree-diff.c:show_tree() for inspiration here.