Code

Add explanation why we do not allow to sparse checkout to empty working tree
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Thu, 22 Sep 2011 11:24:23 +0000 (21:24 +1000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Sep 2011 18:35:48 +0000 (11:35 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c

index 8d4fbaa4ad3400fbf937a1a275dc9f22a3ae6fae..0f205903e170388d800e71d155ac99dccc101846 100644 (file)
@@ -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;
                }