From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 05/16] ls-files: add --narrow-checkout option to "will checkout" entries
Date: Sun, 14 Sep 2008 20:07:54 +0700 [thread overview]
Message-ID: <1221397685-27715-6-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1221397685-27715-5-git-send-email-pclouds@gmail.com>
Even in narrow checkout mode, "git ls-files --cached" (and --stage)
will show all entries in index. When those options are used together
with --narrow-checkout, no-checkout entries will be skipped.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/git-ls-files.txt | 6 ++++++
builtin-ls-files.c | 11 +++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
index 9f85d60..f74b212 100644
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -12,6 +12,7 @@ SYNOPSIS
'git ls-files' [-z] [-t] [-v]
(--[cached|deleted|others|ignored|stage|unmerged|killed|modified])\*
(-[c|d|o|i|s|u|k|m])\*
+ [--narrow-checkout]
[-x <pattern>|--exclude=<pattern>]
[-X <file>|--exclude-from=<file>]
[--exclude-per-directory=<file>]
@@ -72,6 +73,11 @@ OPTIONS
to file/directory conflicts for checkout-index to
succeed.
+--narrow-checkout::
+ When narrow checkout is being used, this option together with other
+ index-based selection options like --cached or --stage, only narrowed
+ portion will be printed out.
+
-z::
\0 line termination on output.
diff --git a/builtin-ls-files.c b/builtin-ls-files.c
index 068f424..456d41c 100644
--- a/builtin-ls-files.c
+++ b/builtin-ls-files.c
@@ -20,6 +20,7 @@ static int show_unmerged;
static int show_modified;
static int show_killed;
static int show_valid_bit;
+static int narrow_checkout;
static int line_terminator = '\n';
static int prefix_len;
@@ -245,6 +246,8 @@ static void show_files(struct dir_struct *dir, const char *prefix)
continue;
if (ce->ce_flags & CE_UPDATE)
continue;
+ if (narrow_checkout && ce_no_checkout(ce))
+ continue;
show_ce_entry(ce_stage(ce) ? tag_unmerged : tag_cached, ce);
}
}
@@ -424,6 +427,7 @@ int report_path_error(const char *ps_matched, const char **pathspec, int prefix_
static const char ls_files_usage[] =
"git ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* "
+ "[ --narrow-checkout ] "
"[ --ignored ] [--exclude=<pattern>] [--exclude-from=<file>] "
"[ --exclude-per-directory=<filename> ] [--exclude-standard] "
"[--full-name] [--abbrev] [--] [<file>]*";
@@ -465,6 +469,10 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
show_cached = 1;
continue;
}
+ if (!strcmp(arg, "--narrow-checkout")) {
+ narrow_checkout = 1;
+ continue;
+ }
if (!strcmp(arg, "-d") || !strcmp(arg, "--deleted")) {
show_deleted = 1;
continue;
@@ -596,6 +604,9 @@ int cmd_ls_files(int argc, const char **argv, const char *prefix)
show_killed | show_modified))
show_cached = 1;
+ if (narrow_checkout && !show_cached && !show_stage)
+ die("ls-files: --narrow-checkout can only be used with either --cached or --stage");
+
read_cache();
if (prefix)
prune_cache(prefix);
--
1.6.0.96.g2fad1.dirty
next prev parent reply other threads:[~2008-09-14 13:10 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-14 13:07 [PATCH 00/16] Narrow/Partial/Sparse checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 01/16] Extend index to save more flags Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 02/16] Introduce CE_NO_CHECKOUT bit Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 03/16] update-index: refactor mark_valid() in preparation for new options Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 04/16] update-index: add --checkout/--no-checkout to update CE_NO_CHECKOUT bit Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` Nguyễn Thái Ngọc Duy [this message]
2008-09-14 13:07 ` [PATCH 06/16] Add tests for updating no-checkout entries in index Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 07/16] Prevent diff machinery from examining worktree outside narrow checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 08/16] checkout_entry(): CE_NO_CHECKOUT on checked out entries Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 09/16] ls-files: apply --deleted on narrow area only Nguyễn Thái Ngọc Duy
2008-09-14 13:07 ` [PATCH 10/16] grep: skip files that have not been checked out Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 11/16] unpack_trees(): add support for narrow checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 12/16] narrow spec: put '+' before a spec will change semantic of '*' Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 13/16] ls-files: add --narrow-match=spec option for testing narrow matching Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 14/16] clone: support narrow checkout with --path option Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 15/16] checkout: add new options to support narrow checkout Nguyễn Thái Ngọc Duy
2008-09-14 13:08 ` [PATCH 16/16] ls-files: add --overlay option Nguyễn Thái Ngọc Duy
2008-09-14 21:10 ` Jakub Narebski
2008-09-15 19:35 ` Junio C Hamano
2008-09-16 12:00 ` Nguyen Thai Ngoc Duy
2008-09-16 17:00 ` Junio C Hamano
2008-09-14 21:12 ` [PATCH 15/16] checkout: add new options to support narrow checkout Jakub Narebski
2008-09-16 9:53 ` Baz
2008-09-16 10:17 ` Johannes Sixt
2008-09-16 13:13 ` Nguyen Thai Ngoc Duy
2008-09-14 19:01 ` [PATCH 14/16] clone: support narrow checkout with --path option Jakub Narebski
2008-09-15 20:27 ` Junio C Hamano
2008-09-14 18:58 ` [PATCH 13/16] ls-files: add --narrow-match=spec option for testing narrow matching Jakub Narebski
2008-09-15 19:34 ` [PATCH 11/16] unpack_trees(): add support for narrow checkout Junio C Hamano
2008-09-16 11:45 ` Nguyen Thai Ngoc Duy
2008-09-14 18:56 ` [PATCH 10/16] grep: skip files that have not been checked out Jakub Narebski
2008-09-15 19:35 ` [PATCH 09/16] ls-files: apply --deleted on narrow area only Junio C Hamano
2008-09-14 18:55 ` [PATCH 05/16] ls-files: add --narrow-checkout option to "will checkout" entries Jakub Narebski
2008-09-15 20:20 ` Junio C Hamano
2008-09-14 18:50 ` [PATCH 04/16] update-index: add --checkout/--no-checkout to update CE_NO_CHECKOUT bit Jakub Narebski
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=1221397685-27715-6-git-send-email-pclouds@gmail.com \
--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).