All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>
Subject: [PATCH 15/23] Introduce "sparse checkout"
Date: Mon, 14 Dec 2009 17:30:58 +0700	[thread overview]
Message-ID: <1260786666-8405-16-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1260786666-8405-1-git-send-email-pclouds@gmail.com>

With skip-worktree bit, you can manually set it to unwanted files,
then remove them: you would have the so-called sparse checkout. The
disadvantages are:

 - Porcelain tools are not aware of this. Everytime you do an
   operation that may update working directory, skip-worktree may be
   cleared out. You have to set them again.

 - You still have to remove skip-worktree'd files manually, which is
   boring and ineffective.

These will be addressed in the following patches. This patch gives an
idea what is "sparse checkout" in Documentation/git-read-tree.txt.
This file is chosen instead of git-checkout.txt because it is quite
technical and user-unfriendly. I'd expect git-checkout.txt to have
something when Porcelain support is done.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/git-read-tree.txt |   44 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
index 4a932b0..8b39716 100644
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -360,6 +360,50 @@ middle of doing, and when your working tree is ready (i.e. you
 have finished your work-in-progress), attempt the merge again.
 
 
+Sparse checkout
+---------------
+
+"Sparse checkout" allows to sparsely populate working directory.
+It uses skip-worktree bit (see linkgit:git-update-index[1]) to tell
+Git whether a file on working directory is worth looking at.
+
+"git read-tree" and other merge-based commands ("git merge", "git
+checkout"...) can help maintaining skip-worktree bitmap and working
+directory update. `$GIT_DIR/info/sparse-checkout` is used to
+define the skip-worktree reference bitmap. When "git read-tree" needs
+to update working directory, it will reset skip-worktree bit in index
+based on this file, which uses the same syntax as .gitignore files.
+If an entry matches a pattern in this file, skip-worktree will be
+set on that entry. Otherwise, skip-worktree will be unset.
+
+Then it compares the new skip-worktree value with the previous one. If
+skip-worktree turns from unset to set, it will add the corresponding
+file back. If it turns from set to unset, that file will be removed.
+
+While `$GIT_DIR/info/sparse-checkout` is usually used to specify what
+files are in. You can also specify what files are _not_ in, using
+negate patterns. For example, to remove file "unwanted":
+
+----------------
+*
+!unwanted
+----------------
+
+Another tricky thing is fully repopulating working directory when you
+no longer want sparse checkout. You cannot just disable "sparse
+checkout" because skip-worktree are still in the index and you working
+directory is still sparsely populated. You should re-populate working
+directory with the `$GIT_DIR/info/sparse-checkout` file content as
+follows:
+
+----------------
+*
+----------------
+
+Then you can disable sparse checkout. Sparse checkout support in "git
+read-tree" and similar commands is disabled by default.
+
+
 SEE ALSO
 --------
 linkgit:git-write-tree[1]; linkgit:git-ls-files[1];
-- 
1.6.5.2.216.g9c1ec

  parent reply	other threads:[~2009-12-14 10:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-14 10:30 [PATCH 00/23] nd/sparse reroll Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 01/23] update-index: refactor mark_valid() in preparation for new options Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 02/23] Add test-index-version Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 03/23] Introduce "skip-worktree" bit in index, teach Git to get/set this bit Nguyễn Thái Ngọc Duy
2009-12-14 23:06   ` Greg Price
2009-12-15  3:51     ` Nguyen Thai Ngoc Duy
2009-12-15  7:20       ` Johannes Sixt
2009-12-15  8:05         ` Nguyen Thai Ngoc Duy
2009-12-14 10:30 ` [PATCH 04/23] update-index: ignore update request if it's skip-worktree Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 05/23] Teach ls-files and update-index to respect skip-worktree bit Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 06/23] Teach diff machinery " Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 07/23] Teach grep " Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 08/23] Teach commit " Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 09/23] Teach Git to respect skip-worktree bit (writing part) Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 10/23] Avoid writing to buffer in add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 11/23] Read .gitignore from index if it is skip-worktree Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 12/23] unpack-trees(): carry skip-worktree bit over in merged_entry() Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 13/23] excluded_1(): support exclude files in index Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` [PATCH 14/23] dir.c: export excluded_1() and add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-12-14 10:30 ` Nguyễn Thái Ngọc Duy [this message]
2009-12-14 10:30 ` [PATCH 16/23] unpack-trees(): add CE_WT_REMOVE to remove on worktree alone Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 17/23] unpack-trees.c: generalize verify_* functions Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 18/23] unpack-trees(): "enable" sparse checkout and load $GIT_DIR/info/sparse-checkout Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 19/23] unpack_trees(): apply $GIT_DIR/info/sparse-checkout to the final index Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 20/23] unpack-trees(): ignore worktree check outside checkout area Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 21/23] read-tree: add --no-sparse-checkout to disable sparse checkout support Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 22/23] Add tests for sparse checkout Nguyễn Thái Ngọc Duy
2009-12-14 10:31 ` [PATCH 23/23] sparse checkout: inhibit empty worktree Nguyễn Thái Ngọc Duy
2009-12-14 11:09 ` [PATCH 00/23] nd/sparse reroll Johannes Sixt
2009-12-14 11:11   ` Nguyen Thai Ngoc Duy

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1260786666-8405-16-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.