From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: szeder.dev@gmail.com, newren@gmail.com, jon@jonsimons.org,
Derrick Stolee <dstolee@microsoft.com>,
Junio C Hamano <gitster@pobox.com>,
Derrick Stolee <dstolee@microsoft.com>
Subject: [PATCH v2 2/2] sparse-checkout: document interactions with submodules
Date: Fri, 27 Dec 2019 18:47:48 +0000 [thread overview]
Message-ID: <331bb7d6fbec6f2f429feb36cf32e0931307ae0b.1577472469.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.500.v2.git.1577472469.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
Junio asked what the behavior is between the sparse-checkout feature
and the submodule feature. The sparse-checkout builtin has not changed
the way these features interact, but we may as well document it in
the builtin docs.
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>
---
Documentation/git-sparse-checkout.txt | 10 ++++++++++
t/t1091-sparse-checkout-builtin.sh | 28 +++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/Documentation/git-sparse-checkout.txt b/Documentation/git-sparse-checkout.txt
index dcca9ee826..2b7aaa0310 100644
--- a/Documentation/git-sparse-checkout.txt
+++ b/Documentation/git-sparse-checkout.txt
@@ -164,6 +164,16 @@ case-insensitive check. This corrects for case mismatched filenames in the
'git sparse-checkout set' command to reflect the expected cone in the working
directory.
+
+SUBMODULES
+----------
+
+If your repository contains one or more submodules, then those submodules will
+appear based on which you initialized with the `git submodule` command. If
+your sparse-checkout patterns exclude an initialized submodule, then that
+submodule will still appear in your working directory.
+
+
SEE ALSO
--------
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh
index 37f6d8fa90..5572beeeca 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -340,4 +340,32 @@ test_expect_success 'cone mode: set with core.ignoreCase=true' '
test_cmp expect dir
'
+test_expect_success 'interaction with submodules' '
+ git clone repo super &&
+ (
+ cd super &&
+ mkdir modules &&
+ git submodule add ../repo modules/child &&
+ git add . &&
+ git commit -m "add submodule" &&
+ git sparse-checkout init --cone &&
+ git sparse-checkout set folder1
+ ) &&
+ list_files super >dir &&
+ cat >expect <<-EOF &&
+ a
+ folder1
+ modules
+ EOF
+ test_cmp expect dir &&
+ list_files super/modules/child >dir &&
+ cat >expect <<-EOF &&
+ a
+ deep
+ folder1
+ folder2
+ EOF
+ test_cmp expect dir
+'
+
test_done
--
gitgitgadget
next prev parent reply other threads:[~2019-12-27 18:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-26 20:49 [PATCH 0/1] sparse-checkout: list directories in cone mode Derrick Stolee via GitGitGadget
2019-12-26 20:49 ` [PATCH 1/1] sparse-checkout: list folders " Derrick Stolee via GitGitGadget
2019-12-26 21:17 ` Junio C Hamano
2019-12-27 14:05 ` Derrick Stolee
2019-12-27 15:52 ` Elijah Newren
2019-12-27 18:47 ` [PATCH v2 0/2] sparse-checkout: list directories " Derrick Stolee via GitGitGadget
2019-12-27 18:47 ` [PATCH v2 1/2] sparse-checkout: list folders " Derrick Stolee via GitGitGadget
2019-12-27 21:37 ` Elijah Newren
2019-12-27 18:47 ` Derrick Stolee via GitGitGadget [this message]
2019-12-27 20:20 ` [PATCH v2 2/2] sparse-checkout: document interactions with submodules Eric Sunshine
2019-12-30 13:11 ` Derrick Stolee
2019-12-27 21:46 ` Elijah Newren
2019-12-27 22:33 ` Junio C Hamano
2019-12-30 15:33 ` [PATCH v3 0/2] sparse-checkout: list directories in cone mode Derrick Stolee via GitGitGadget
2019-12-30 15:33 ` [PATCH v3 1/2] " Derrick Stolee via GitGitGadget
2019-12-30 15:33 ` [PATCH v3 2/2] sparse-checkout: document interactions with submodules Derrick Stolee via GitGitGadget
2019-12-30 17:18 ` [PATCH v3 0/2] sparse-checkout: list directories in cone mode Elijah Newren
2019-12-27 21:47 ` [PATCH 0/1] " Elijah Newren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=331bb7d6fbec6f2f429feb36cf32e0931307ae0b.1577472469.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jon@jonsimons.org \
--cc=newren@gmail.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).