From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
To: git@vger•kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx•de>,
Junio C Hamano <gitster@pobox•com>
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail•com>
Subject: [RFC PATCH v3 8/8] --sparse for porcelains
Date: Tue, 11 Aug 2009 22:44:06 +0700 [thread overview]
Message-ID: <1250005446-12047-9-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1250005446-12047-8-git-send-email-pclouds@gmail.com>
This series is useless until now because no one would use read-tree to
checkout. At least with this, you can really use/test the series.
Porcelain design was originally "if you have .git/info/sparse,
porcelains will use it, if you don't like that, remove
.git/info/sparse" while plumblings have an option to
enable/disable this feature.
And I still like that behavior. How about we enable sparse checkout
by default for porcelains and make a config option to disable it?
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail•com>
---
builtin-checkout.c | 4 ++++
builtin-merge.c | 5 ++++-
git-pull.sh | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/builtin-checkout.c b/builtin-checkout.c
index 446cac7..cec21ab 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -30,6 +30,7 @@ struct checkout_opts {
int force;
int writeout_stage;
int writeout_error;
+ int apply_sparse;
const char *new_branch;
int new_branch_log;
@@ -402,6 +403,7 @@ static int merge_working_tree(struct checkout_opts *opts,
topts.dir = xcalloc(1, sizeof(*topts.dir));
topts.dir->flags |= DIR_SHOW_IGNORED;
topts.dir->exclude_per_dir = ".gitignore";
+ topts.apply_sparse = opts->apply_sparse;
tree = parse_tree_indirect(old->commit->object.sha1);
init_tree_desc(&trees[0], tree->buffer, tree->size);
tree = parse_tree_indirect(new->commit->object.sha1);
@@ -594,6 +596,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
OPT_STRING(0, "conflict", &conflict_style, "style",
"conflict style (merge or diff3)"),
+ OPT_SET_INT(0, "sparse", &opts.apply_sparse,
+ "apply sparse checkout filter", 1),
OPT_END(),
};
int has_dash_dash;
diff --git a/builtin-merge.c b/builtin-merge.c
index 0b12fb3..c14b91d 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -43,7 +43,7 @@ static const char * const builtin_merge_usage[] = {
static int show_diffstat = 1, option_log, squash;
static int option_commit = 1, allow_fast_forward = 1;
-static int allow_trivial = 1, have_message;
+static int allow_trivial = 1, have_message, apply_sparse;
static struct strbuf merge_msg;
static struct commit_list *remoteheads;
static unsigned char head[20], stash[20];
@@ -172,6 +172,7 @@ static struct option builtin_merge_options[] = {
OPT_CALLBACK('m', "message", &merge_msg, "message",
"message to be used for the merge commit (if any)",
option_parse_message),
+ OPT_SET_INT(0, "sparse", &apply_sparse, "apply sparse checkout filter", 1),
OPT__VERBOSITY(&verbosity),
OPT_END()
};
@@ -494,6 +495,7 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,
opts.verbose_update = 1;
opts.trivial_merges_only = 1;
opts.merge = 1;
+ opts.apply_sparse = apply_sparse;
trees[nr_trees] = parse_tree_indirect(common);
if (!trees[nr_trees++])
return -1;
@@ -646,6 +648,7 @@ static int checkout_fast_forward(unsigned char *head, unsigned char *remote)
opts.verbose_update = 1;
opts.merge = 1;
opts.fn = twoway_merge;
+ opts.apply_sparse = apply_sparse;
trees[nr_trees] = parse_tree_indirect(head);
if (!trees[nr_trees++])
diff --git a/git-pull.sh b/git-pull.sh
index 0f24182..ba583bf 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -20,6 +20,7 @@ strategy_args= diffstat= no_commit= squash= no_ff= log_arg= verbosity=
curr_branch=$(git symbolic-ref -q HEAD)
curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
rebase=$(git config --bool branch.$curr_branch_short.rebase)
+sparse=
while :
do
case "$1" in
@@ -65,6 +66,9 @@ do
--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)
rebase=false
;;
+ --sparse)
+ sparse=--sparse
+ ;;
-h|--h|--he|--hel|--help)
usage
;;
@@ -201,5 +205,5 @@ merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
test true = "$rebase" &&
exec git-rebase $diffstat $strategy_args --onto $merge_head \
${oldremoteref:-$merge_head}
-exec git-merge $diffstat $no_commit $squash $no_ff $log_arg $strategy_args \
+exec git-merge $sparse $diffstat $no_commit $squash $no_ff $log_arg $strategy_args \
"$merge_name" HEAD $merge_head $verbosity
--
1.6.3.GIT
next prev parent reply other threads:[~2009-08-11 15:45 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-11 15:43 [RFC PATCH v3 0/8] Sparse checkout Nguyễn Thái Ngọc Duy
2009-08-11 15:43 ` [RFC PATCH v3 1/8] Prevent diff machinery from examining assume-unchanged entries on worktree Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 2/8] Avoid writing to buffer in add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 3/8] Read .gitignore from index if it is assume-unchanged Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 4/8] excluded_1(): support exclude "directories" in index Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 5/8] dir.c: export excluded_1() and add_excludes_from_file_1() Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 6/8] unpack-trees.c: generalize verify_* functions Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` [RFC PATCH v3 7/8] Support sparse checkout in unpack_trees() and read-tree Nguyễn Thái Ngọc Duy
2009-08-11 15:44 ` Nguyễn Thái Ngọc Duy [this message]
2009-08-12 6:33 ` [RFC PATCH v3 8/8] --sparse for porcelains Junio C Hamano
2009-08-12 10:01 ` Nguyen Thai Ngoc Duy
2009-08-13 7:20 ` Nguyen Thai Ngoc Duy
2009-08-13 9:58 ` Jakub Narebski
2009-08-13 12:38 ` Nguyen Thai Ngoc Duy
2009-08-14 20:23 ` Jakub Narebski
2009-08-15 2:01 ` Junio C Hamano
2009-08-15 23:37 ` Jakub Narebski
2009-08-16 8:14 ` Johannes Schindelin
2009-08-17 9:08 ` Johannes Schindelin
2009-08-17 12:49 ` Nguyen Thai Ngoc Duy
2009-08-17 13:35 ` Johannes Schindelin
2009-08-17 14:41 ` Nguyen Thai Ngoc Duy
2009-08-17 15:19 ` Johannes Schindelin
2009-08-17 16:13 ` Nguyen Thai Ngoc Duy
2009-08-17 15:41 ` Junio C Hamano
2009-08-17 16:06 ` Nguyen Thai Ngoc Duy
2009-08-17 16:19 ` Johannes Schindelin
2009-08-17 18:39 ` Junio C Hamano
2009-08-17 22:02 ` Johannes Schindelin
2009-08-17 23:02 ` skillzero
2009-08-17 23:16 ` Johannes Schindelin
2009-08-18 0:17 ` Jakub Narebski
2009-08-18 0:34 ` skillzero
2009-08-18 1:43 ` Nguyen Thai Ngoc Duy
2009-08-18 6:25 ` git find (was: [RFC PATCH v3 8/8] --sparse for porcelains) Jakub Narebski
2009-08-18 14:35 ` Nguyen Thai Ngoc Duy
2009-08-18 16:00 ` Jakub Narebski
2009-08-18 0:49 ` [RFC PATCH v3 8/8] --sparse for porcelains Jakub Narebski
2009-08-18 0:23 ` skillzero
2009-08-17 16:46 ` Junio C Hamano
2009-08-17 21:45 ` Johannes Schindelin
2009-08-17 16:01 ` Jakub Narebski
2009-08-12 7:31 ` Johannes Sixt
2009-08-12 9:53 ` Nguyen Thai Ngoc Duy
2009-08-12 15:40 ` Raja R Harinath
2009-08-13 7:37 ` Johannes Sixt
2009-08-11 21:18 ` [RFC PATCH v3 7/8] Support sparse checkout in unpack_trees() and read-tree skillzero
2009-08-11 21:38 ` Jakub Narebski
2009-08-11 22:03 ` skillzero
2009-08-12 1:30 ` Nguyen Thai Ngoc Duy
2009-08-12 4:59 ` skillzero
2009-08-12 2:51 ` [RFC PATCH v3 3/8] Read .gitignore from index if it is assume-unchanged Junio C Hamano
2009-08-13 6:37 ` 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=1250005446-12047-9-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail$(echo .)com \
--cc=Johannes.Schindelin@gmx$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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