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
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [RFC PATCH v2 4/4] read-tree: add --no-sparse to turn off sparse hook
Date: Mon, 10 Aug 2009 22:19:22 +0700	[thread overview]
Message-ID: <1249917562-5931-5-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1249917562-5931-4-git-send-email-pclouds@gmail.com>


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin-read-tree.c         |    4 +++-
 t/t1009-read-tree-sparse.sh |    6 ++++++
 unpack-trees.c              |    6 ++++--
 unpack-trees.h              |    1 +
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 9c2d634..4c1061e 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -31,7 +31,7 @@ static int list_tree(unsigned char *sha1)
 }
 
 static const char * const read_tree_usage[] = {
-	"git read-tree [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u [--exclude-per-directory=<gitignore>] | -i]]  [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]]",
+	"git read-tree [[-m [--trivial] [--aggressive] | --reset | --prefix=<prefix>] [-u [--exclude-per-directory=<gitignore>] | -i]] [--no-sparse] [--index-output=<file>] <tree-ish1> [<tree-ish2> [<tree-ish3>]]",
 	NULL
 };
 
@@ -98,6 +98,8 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
 		  PARSE_OPT_NONEG, exclude_per_directory_cb },
 		OPT_SET_INT('i', NULL, &opts.index_only,
 			    "don't check the working tree after merging", 1),
+		OPT_SET_INT(0, "no-sparse", &opts.no_sparse_hook,
+			    "do not run sparse hook", 1),
 		OPT_END()
 	};
 
diff --git a/t/t1009-read-tree-sparse.sh b/t/t1009-read-tree-sparse.sh
index b613a89..18115b1 100755
--- a/t/t1009-read-tree-sparse.sh
+++ b/t/t1009-read-tree-sparse.sh
@@ -39,4 +39,10 @@ test_expect_success 're-add one' '
 	test -f one
 '
 
+test_expect_success 'read-tree --no-sparse' '
+	make_hook "git update-index --assume-unchanged one"
+	git read-tree -u -m --no-sparse HEAD &&
+	test -f one
+'
+
 test_done
diff --git a/unpack-trees.c b/unpack-trees.c
index f407bf5..d087112 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -530,8 +530,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 	if (o->trivial_merges_only && o->nontrivial_merge)
 		return unpack_failed(o, "Merge requires file-level merging");
 
-	if (run_sparse_hook(o))
-		return unpack_failed(o, NULL);
+	if (!o->no_sparse_hook) {
+		if (run_sparse_hook(o))
+			return unpack_failed(o, NULL);
+	}
 
 	o->src_index = NULL;
 	ret = check_updates(o) ? (-2) : 0;
diff --git a/unpack-trees.h b/unpack-trees.h
index ad21823..81eb2ef 100644
--- a/unpack-trees.h
+++ b/unpack-trees.h
@@ -30,6 +30,7 @@ struct unpack_trees_options {
 		     skip_unmerged,
 		     initial_checkout,
 		     diff_index_cached,
+		     no_sparse_hook,
 		     gently;
 	const char *prefix;
 	int pos;
-- 
1.6.3.GIT

  reply	other threads:[~2009-08-10 15:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 15:19 [RFC PATCH v2 0/4] Sparse checkout Nguyễn Thái Ngọc Duy
2009-08-10 15:19 ` [RFC PATCH v2 1/4] Prevent diff machinery from examining assume-unchanged entries on worktree Nguyễn Thái Ngọc Duy
2009-08-10 15:19   ` [RFC PATCH v2 2/4] gitignore: read from index if .gitignore is assume-unchanged Nguyễn Thái Ngọc Duy
2009-08-10 15:19     ` [RFC PATCH v2 3/4] unpack_trees(): add support for sparse checkout Nguyễn Thái Ngọc Duy
2009-08-10 15:19       ` Nguyễn Thái Ngọc Duy [this message]
2009-08-10 16:46         ` [RFC PATCH v2 4/4] read-tree: add --no-sparse to turn off sparse hook Johannes Schindelin
2009-08-11  1:38           ` Nguyen Thai Ngoc Duy
2009-08-11  5:13             ` Junio C Hamano
2009-08-11  6:50               ` Johannes Schindelin
2009-08-11  7:08                 ` Nguyen Thai Ngoc Duy
2009-08-10 16:41       ` [RFC PATCH v2 3/4] unpack_trees(): add support for sparse checkout Johannes Schindelin
2009-08-11  1:47         ` Nguyen Thai Ngoc Duy
2009-08-11  7:02           ` Johannes Schindelin
2009-08-10 16:33     ` [RFC PATCH v2 2/4] gitignore: read from index if .gitignore is assume-unchanged Johannes Schindelin
2009-08-11  1:57       ` Nguyen Thai Ngoc Duy
2009-08-11  8:12         ` Johannes Schindelin
2009-08-10 16:20   ` [RFC PATCH v2 1/4] Prevent diff machinery from examining assume-unchanged entries on worktree Johannes Schindelin
2009-08-11  1:34     ` Nguyen Thai Ngoc Duy
2009-08-11  6:45       ` Johannes Schindelin

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=1249917562-5931-5-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).