git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Subject: [RFC PATCH 0/9] Narrow/Sparse checkout round 3: "easy mode"
Date: Fri, 15 Aug 2008 21:24:39 +0700	[thread overview]
Message-ID: <20080815142439.GA10609@laptop> (raw)

The implementation with insights from Junio turns out smaller and better
(and I was thinking about applying it for huge maildir).

So there is a bit of changes since the last round. This time I follow
"assume unchanged" code path and relax the rules a bit. There are issues
I will mention later.

From user POV, we can now checkout a single file or a subdirectory (checking
out subdirectory non-recursively is possible too). You may start with a narrow
clone like:

git clone --path="Documentation/*" git.git

or start from a full checkout and narrow it (very much like the last round):

git checkout --path="Documentation/*"

However narrow spec is now using wildcards, not prefix, so you can checkout
a single file, or just header files, etc.

git checkout --add-path|--remove-path has been aded to update narrow areas.
But you don't have to use those. Narrow areas will be widened as needed when
you do something outside of it (e.g "git checkout foo" or "git add foo"...)

Another difference from the last round is "narrow rules" will not be preserved
when switching branches. When you switch branch with no option, you will get
full checkout. You may want to use --path|--add-path|--remove-path when
switching branches to have narrow checkout again.

Now back to technical POV. I did not reuse CE_VALID (assume unchanged) bit
because it has been used for core.ignorestat. So I took another bit, which
seems to be the last on-disk bit in ce_flags.

I call this mode "easy mode" because most of constraints have been eliminated.
Now your "narrow rules" are like "I don't like those files, remove them if
they are not needed". If some operations
need those files on workdir again, they will be checked out. Those may include:

 - "git checkout foo" or "git apply"
 - git add foo (even if foo is marked no-checkout)
 - conflict files after merge
 - new files after merge

"Strict mode" may be added later but then it must clearly define which
operation is allowed to checkout files. There's a problem with strict mode if
it wants to limit checking out new files after merge. Because we don't save
"narrow rules" anymore (we applied the rules immediately in checkout/clone
stage, then update narrow areas over time), we will not know how to deal with
new files. Adding [--path|--add-path|--remove-path] to git merge commands, and
apply "narrow rules" again, looks too cumbersome to me. Comments?

Last bit. "Narrow rules" for --path|--add-path|--remove-path is currently
wildcards separated by colons. While it does the job, it does not allow to
checkout easily a subdirectory non-recusively. I was thinking about '*' as
"match everything except slashes" and '**' as "match everything even slashes".
Any ideas?

Oh.. and "git grep" may not work correctly (or "as expected") with narrow
checkout. Haven't checked it yet.

Nguyễn Thái Ngọc Duy (9):
  Introduce CE_NO_CHECKOUT bit
  update-index: add --checkout/--no-checkout options to update
    CE_NO_CHECKOUT bit
  ls-files: add --checkout option to show checked out files
  Prevent diff machinery from examining worktree outside narrow
    checkout
  Clear CE_NO_CHECKOUT on checked out entries.
  Add support for narrow checkout in unpack_trees()
  ls-files: add --narrow-match=spec option to test narrow matching
  clone: support narrow checkout with --path option
  checkout: add new options to support narrow checkout

 builtin-checkout.c     |   41 ++++++++++++++++++
 builtin-clone.c        |   13 ++++++
 builtin-ls-files.c     |   23 +++++++++--
 builtin-update-index.c |   40 +++++++++++-------
 cache.h                |   11 +++++
 diff-lib.c             |    5 +-
 diff.c                 |    4 +-
 entry.c                |    1 +
 read-cache.c           |    6 +-
 unpack-trees.c         |  106 ++++++++++++++++++++++++++++++++++++++++++++++++
 unpack-trees.h         |    4 ++
 11 files changed, 229 insertions(+), 25 deletions(-)

             reply	other threads:[~2008-08-15 14:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 14:24 Nguyễn Thái Ngọc Duy [this message]
2008-08-16 10:31 ` [RFC PATCH 0/9] Narrow/Sparse checkout round 3: "easy mode" Junio C Hamano
2008-08-17  5:12   ` Nguyen Thai Ngoc Duy
2008-08-17  5:50     ` Junio C Hamano
2008-08-17  6:10       ` Junio C Hamano
2008-08-17  9:49         ` [RFC PATCH 0/9] Narrow/Sparse checkout round 3: Eric Raible
2008-08-19  9:06           ` Junio C Hamano
2008-08-17 13:36         ` [RFC PATCH 0/9] Narrow/Sparse checkout round 3: "easy mode" Nguyen Thai Ngoc Duy
2008-08-19 21:10 ` James Pickens
2008-08-30  9:21   ` 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=20080815142439.GA10609@laptop \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    /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 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 NNTP newsgroup(s).