Re: [PATCH v2] checkout: add --no-widen for restoring files in sparse checkout mode
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 1, 2013, 06:18 UTC
- Message-ID
- <20130401061813.GJ11704@elie.Belkin>
- In-Reply-To
- <CACsJy8BVcu2VwxgQ9URViHMx2+6436npcYSHyZ5Mj0aVhVFtug@mail.gmail.com>
Duy Nguyen wrote:
> On Mon, Apr 1, 2013 at 11:48 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 7 quoted lines
>> I'm afraid I can't imagine when --no-respect-skip-worktree would be >> useful. That can easily be a failure of my imagination, though. > > There may be scripts that expect "git checkout -- foo" to reset > everything in "foo". Or maybe you just want to check out a single file > and do not bother to edit sparse patterns as you won't need it for > long.
Those scripts are bringing suffering on themselves by using porcelain instead of "git checkout-index". The usual way to look at a single file from the index is "git show :git.c >git.c".
So you've convinced me. I think --respect-skip-worktree can be just the normal behavior (and that there's no need for a --no-respect option). That would let me do:
git clone --no-checkout git://repo.or.cz/git.git cd git echo '/Documentation/' >.git/info/sparse-checkout git config core.sparsecheckout true git checkout
printf '%s\n' /README /INSTALL /COPYING >>.git/info/sparse-checkout git checkout
... hack hack hack ...
# return to what the index has git checkout .
without having to see any pesky actual source (*.c) files.