@matheusbsbs / matheus-bagliano / commits / 4fd683b6a3
Fork 0

sparse-checkout: document interactions with submodules

Using 'git submodule (init|deinit)' a user can select a subset of submodules to populate. This behaves very similar to the sparse-checkout feature, but those directories contain their own .git directory including an object database and ref space. To have the sparse-checkout file also determine if those files should exist would easily cause problems. Therefore, keeping these features independent in this way is the best way forward. Also create a test that demonstrates this behavior to make sure it doesn't change as the sparse-checkout feature evolves. Reported-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Dec 30, 2019 at 15:33 UTC 4fd683b6a35eabd23dd5183da7f654a1e1f00325
2 files changed +38
Documentation/git-sparse-checkout.txt
+10
@@ -164,6 +164,16 @@ case-insensitive check. This corrects for case mismatched filenames in the
164 'git sparse-checkout set' command to reflect the expected cone in the working
165 directory.
166
167 +
168 +SUBMODULES
169 +----------
170 +
171 +If your repository contains one or more submodules, then those submodules will
172 +appear based on which you initialized with the `git submodule` command. If
173 +your sparse-checkout patterns exclude an initialized submodule, then that
174 +submodule will still appear in your working directory.
175 +
176 +
177 SEE ALSO
178 --------
179
t/t1091-sparse-checkout-builtin.sh
+28
@@ -340,4 +340,32 @@ test_expect_success 'cone mode: set with core.ignoreCase=true' '
340 test_cmp expect dir
341 '
342
343 +test_expect_success 'interaction with submodules' '
344 + git clone repo super &&
345 + (
346 + cd super &&
347 + mkdir modules &&
348 + git submodule add ../repo modules/child &&
349 + git add . &&
350 + git commit -m "add submodule" &&
351 + git sparse-checkout init --cone &&
352 + git sparse-checkout set folder1
353 + ) &&
354 + list_files super >dir &&
355 + cat >expect <<-\EOF &&
356 + a
357 + folder1
358 + modules
359 + EOF
360 + test_cmp expect dir &&
361 + list_files super/modules/child >dir &&
362 + cat >expect <<-\EOF &&
363 + a
364 + deep
365 + folder1
366 + folder2
367 + EOF
368 + test_cmp expect dir
369 +'
370 +
371 test_done