Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:56:35

Jonathan Nieder [off-list ref] writes:
Nguyễn Thái Ngọc Duy wrote:
quoted
"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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help