summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a2a1da8)
raw | patch | inline | side by side (parent: a2a1da8)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Fri, 17 Dec 2010 12:43:06 +0000 (19:43 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 17 Dec 2010 22:40:47 +0000 (14:40 -0800) |
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/add.c | patch | blob | history | |
builtin/diff.c | patch | blob | history | |
builtin/fast-export.c | patch | blob | history | |
diff-lib.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history | |
wt-status.c | patch | blob | history |
diff --git a/builtin/add.c b/builtin/add.c
index 56a4e0af6b35ea9f6d86accad27a1c87bc5ad0d9..3fc79a5d3f74d0ae5ab4f2e69a5afa9d48553e04 100644 (file)
--- a/builtin/add.c
+++ b/builtin/add.c
struct rev_info rev;
init_revisions(&rev, prefix);
setup_revisions(0, NULL, &rev, NULL);
- rev.prune_data = pathspec;
+ init_pathspec(&rev.prune_data, pathspec);
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = update_callback;
data.flags = flags;
diff --git a/builtin/diff.c b/builtin/diff.c
index 76c42d834f6c3982eaae463689c38eebfc091131..4ebb1b65f45287838d940221ca9886c8820a5057 100644 (file)
--- a/builtin/diff.c
+++ b/builtin/diff.c
}
die("unhandled object '%s' given.", name);
}
- if (rev.prune_data) {
- const char **pathspec = rev.prune_data;
- while (*pathspec) {
- if (!path)
- path = *pathspec;
- paths++;
- pathspec++;
- }
+ if (rev.prune_data.nr) {
+ if (!path)
+ path = rev.prune_data.items[0].match;
+ paths += rev.prune_data.nr;
}
/*
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index c8fd46b872780b27b09ad70316fa164d855f3220..ba57457cc54812ba935c5259277e12d72463f63f 100644 (file)
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
if (import_filename)
import_marks(import_filename);
- if (import_filename && revs.prune_data)
+ if (import_filename && revs.prune_data.nr)
full_tree = 1;
get_tags_and_duplicates(&revs.pending, &extra_refs);
diff --git a/diff-lib.c b/diff-lib.c
index 3b809f2e0d1a937df99d3c3018848930ee13a25b..2251f3df687514acb91a9b4382eb0aac88a7897b 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES))
break;
- if (!ce_path_match(ce, revs->prune_data))
+ if (!ce_path_match(ce, revs->prune_data.raw))
continue;
if (ce_stage(ce)) {
@@ -427,7 +427,7 @@ static int oneway_diff(struct cache_entry **src, struct unpack_trees_options *o)
if (tree == o->df_conflict_entry)
tree = NULL;
- if (ce_path_match(idx ? idx : tree, revs->prune_data))
+ if (ce_path_match(idx ? idx : tree, revs->prune_data.raw))
do_oneway_diff(o, idx, tree);
return 0;
active_nr = dst - active_cache;
init_revisions(&revs, NULL);
- revs.prune_data = opt->pathspec.raw;
+ init_pathspec(&revs.prune_data, opt->pathspec.raw);
tree = parse_tree_indirect(tree_sha1);
if (!tree)
die("bad tree object %s", sha1_to_hex(tree_sha1));
diff --git a/revision.c b/revision.c
index b2a5867dcd15eff3279cdeb2ed1612156cae00b0..515e2dd23b5512888c413ae68de435fa40ccfd0e 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -323,7 +323,7 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct
* tagged commit by specifying both --simplify-by-decoration
* and pathspec.
*/
- if (!revs->prune_data)
+ if (!revs->prune_data.nr)
return REV_TREE_SAME;
}
struct cache_entry *ce = active_cache[i];
if (!ce_stage(ce))
continue;
- if (ce_path_match(ce, revs->prune_data)) {
+ if (ce_path_match(ce, revs->prune_data.raw)) {
prune_num++;
prune = xrealloc(prune, sizeof(*prune) * prune_num);
prune[prune_num-2] = ce->name;
ce_same_name(ce, active_cache[i+1]))
i++;
}
- revs->prune_data = prune;
+ free_pathspec(&revs->prune_data);
+ init_pathspec(&revs->prune_data, prune);
revs->limited = 1;
}
@@ -1616,7 +1617,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
}
if (prune_data)
- revs->prune_data = get_pathspec(revs->prefix, prune_data);
+ init_pathspec(&revs->prune_data, get_pathspec(revs->prefix, prune_data));
if (revs->def == NULL)
revs->def = opt ? opt->def : NULL;
@@ -1647,13 +1648,13 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
if (revs->topo_order)
revs->limited = 1;
- if (revs->prune_data) {
- diff_tree_setup_paths(revs->prune_data, &revs->pruning);
+ if (revs->prune_data.nr) {
+ diff_tree_setup_paths(revs->prune_data.raw, &revs->pruning);
/* Can't prune commits with rename following: the paths change.. */
if (!DIFF_OPT_TST(&revs->diffopt, FOLLOW_RENAMES))
revs->prune = 1;
if (!revs->full_diff)
- diff_tree_setup_paths(revs->prune_data, &revs->diffopt);
+ diff_tree_setup_paths(revs->prune_data.raw, &revs->diffopt);
}
if (revs->combine_merges)
revs->ignore_merges = 0;
diff --git a/revision.h b/revision.h
index 05659c64acd7fe8eb7be011cee6174e397e57baf..82509dd1d9ad7b1824971be4884409060f10aee3 100644 (file)
--- a/revision.h
+++ b/revision.h
/* Basic information */
const char *prefix;
const char *def;
- void *prune_data;
+ struct pathspec prune_data;
unsigned int early_output;
/* Traversal flags */
diff --git a/wt-status.c b/wt-status.c
index 54b6b03b9cc4e168e6b6429679b61dc2a1d5197b..5c6b11849b16e9dfe21d6cb99e411a08ba275c3e 100644 (file)
--- a/wt-status.c
+++ b/wt-status.c
}
rev.diffopt.format_callback = wt_status_collect_changed_cb;
rev.diffopt.format_callback_data = s;
- rev.prune_data = s->pathspec;
+ init_pathspec(&rev.prune_data, s->pathspec);
run_diff_files(&rev, 0);
}
rev.diffopt.detect_rename = 1;
rev.diffopt.rename_limit = 200;
rev.diffopt.break_opt = 0;
- rev.prune_data = s->pathspec;
+ init_pathspec(&rev.prune_data, s->pathspec);
run_diff_index(&rev, 1);
}