Re: [RFC PATCH 06/15] Automatically reuse sparse limiting arguments in revision walking
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Sep 5, 2010, 01:58 UTC
- Message-ID
- <AANLkTik1E=7Uawq-fGXppac3ur-oohq104A5wEgxv8cL@mail.gmail.com>
- In-Reply-To
- <1283645647-1891-7-git-send-email-newren@gmail.com>
On Sun, Sep 5, 2010 at 10:13 AM, Elijah Newren <newren@gmail.com> wrote:
Show 18 quoted lines
> In a sparse repository, by automatically making use of sparse limits > specified at clone time, we can avoid walking uninteresting commits and > prevent access to missing trees and blobs. Note that this means that if > you created a sparse clone with > git clone <repo> <dest_dir> -- PATH1 PATH2 PATH3 PATH4 PATH5 > then > git log > implicitly runs as though you had manually specified > git log -- PATH1 PATH2 PATH3 PATH4 PATH5 > Similarly, running > git diff > implicitly runs as though you had manually specified > git diff -- PATH1 PATH2 PATH3 PATH4 PATH5 > > This is necessary for proper operation of git diff in a sparse clone to > avoid accessing missing objects. In the case of a plain git log, this > merely serves as an additional convenience, but for more complicated log > operations (e.g. when passing -p or -S options) it becomes necessary.
I have a nicer approach here. Instead of modifying setup_revisions() and similar functions, I update get_pathspec() to rewrite the pathspecs from command line in narrow/shallow repos. get_pathspec() currently does some form of rewriting already (prepending prefix).
So if you do "git log", get_pathspec() would return "git log -- PATH1 PATH2...". Will repost my series soon, or I can send that particular patch to you.
-- Duy