Re: [RFC PATCH 06/15] Automatically reuse sparse limiting arguments in revision walking
From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:49:29
On Sun, Sep 5, 2010 at 10:13 AM, Elijah Newren [off-list ref] wrote:
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