From a7bc906f2e64f0d9d3fec91964dc38e390ef69a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Thu, 22 Sep 2011 21:24:23 +1000 Subject: [PATCH] Add explanation why we do not allow to sparse checkout to empty working tree MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- unpack-trees.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unpack-trees.c b/unpack-trees.c index 8d4fbaa4a..0f205903e 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1119,8 +1119,13 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options } if (ret < 0) goto return_failed; + /* + * Sparse checkout is meant to narrow down checkout area + * but it does not make sense to narrow down to empty working + * tree. This is usually a mistake in sparse checkout rules. + * Do not allow users to do that. + */ if (o->result.cache_nr && empty_worktree) { - /* dubious---why should this fail??? */ ret = unpack_failed(o, "Sparse checkout leaves no entry on working directory"); goto done; } -- 2.26.2