Re: [PATCH v2] checkout: add --no-widen for restoring files in sparse checkout mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> Nguyễn Thái Ngọc Duy wrote:
>
>> "git checkout -- <paths>" is usually used to restore all modified
>> files in <paths>. In sparse checkout mode, this command is overloaded
>> with another meaning: to add back all files in <paths> that are
>> excluded by sparse patterns.
>>
>> Add "--no-widen" option to do what normal mode does: restore all
>> modified files and nothing else.
>
> In an ideal world, I would like "git checkout --widen" to modify the
> .git/info/sparse-checkout file, to be able to do:
>
> 	git clone --sparse-checkout=Documentation git://repo.or.cz/git.git
> 	cd git
> 	git checkout --widen -- README COPYING INSTALL
>
> and hack on a tree with Documentation/, README, COPYING, and INSTALL
> present with no actual code to distract.  And "git checkout --no-widen"
> could be a way to ask to respect the existing sparse pattern.

Yeah, I think the above makes tons of sense, and --widen would be an
ideal name for that optional behaviour.  When you are limited by
your original sparse pathspecs, that would be a way to explicitly
widen the paths you interact with.  In that sense, making it off by
default would be a sensible thing to do.  When you limited yourself
to a subset of dir/, you do not want "git checkout dir/" to
automatically widen it by accident.

> This patch isn't about tweaking the sparse-checkout pattern; instead,
> it's about how "git checkout" interacts with the skip-worktree bit.
> Maybe a good name would be --respect-skip-worktree?

Yeah, but when would one want to say --no-respect without widening
the sparce pathspecs?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]