summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 477f2b4)
raw | patch | inline | side by side (parent: 477f2b4)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 11 Apr 2006 01:14:54 +0000 (18:14 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 11 Apr 2006 02:17:31 +0000 (19:17 -0700) |
This makes things that include revision.h build again.
Blame is also built, but I am not sure how well it works (or how
well it worked to begin with) -- it was relying on tree-diff to
be using whatever pathspec was used the last time, which smells
a bit suspicious.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Blame is also built, but I am not sure how well it works (or how
well it worked to begin with) -- it was relying on tree-diff to
be using whatever pathspec was used the last time, which smells
a bit suspicious.
Signed-off-by: Junio C Hamano <junkio@cox.net>
blame.c | patch | blob | history | |
git.c | patch | blob | history | |
http-push.c | patch | blob | history | |
rev-list.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
index 6730b10b115250e088887879d075559a36ddc7b1..07d2d272514bdf68adf756dcb111b47226fbd1d8 100644 (file)
--- a/blame.c
+++ b/blame.c
static int compare_tree_path(struct rev_info* revs,
struct commit* c1, struct commit* c2)
{
+ int ret;
const char* paths[2];
struct util_info* util = c2->object.util;
paths[0] = util->pathname;
paths[1] = NULL;
- diff_tree_setup_paths(get_pathspec(revs->prefix, paths));
- return rev_compare_tree(c1->tree, c2->tree);
+ diff_tree_setup_paths(get_pathspec(revs->prefix, paths),
+ &revs->diffopt);
+ ret = rev_compare_tree(revs, c1->tree, c2->tree);
+ diff_tree_release_paths(&revs->diffopt);
+ return ret;
}
static int same_tree_as_empty_path(struct rev_info *revs, struct tree* t1,
const char* path)
{
+ int ret;
const char* paths[2];
paths[0] = path;
paths[1] = NULL;
- diff_tree_setup_paths(get_pathspec(revs->prefix, paths));
- return rev_same_tree_as_empty(t1);
+ diff_tree_setup_paths(get_pathspec(revs->prefix, paths),
+ &revs->diffopt);
+ ret = rev_same_tree_as_empty(revs, t1);
+ diff_tree_release_paths(&revs->diffopt);
+ return ret;
}
static const char* find_rename(struct commit* commit, struct commit* parent)
diff_opts.recursive = 1;
diff_opts.detect_rename = DIFF_DETECT_RENAME;
paths[0] = NULL;
- diff_tree_setup_paths(paths);
+ diff_tree_setup_paths(paths, &diff_opts);
if (diff_setup_done(&diff_opts) < 0)
die("diff_setup_done failed");
args[0] = filename;
args[1] = NULL;
- diff_tree_setup_paths(args);
+ diff_tree_setup_paths(args, &rev.diffopt);
prepare_revision_walk(&rev);
process_commits(&rev, filename, &initial);
index ad896da5849b9697cf61d7349ee7d4e20611106d..5cb0d32070bfdc067ac02c4a5186c3f2db3d5619 100644 (file)
--- a/git.c
+++ b/git.c
#include "cache.h"
#include "commit.h"
-#include "revision.h"
#include "diff.h"
+#include "revision.h"
#include "log-tree.h"
#ifndef PATH_MAX
diff --git a/http-push.c b/http-push.c
index 57cefdea530171c71c72229a85aa0212dedb2c5a..aa0bc1f6f6a51fb39d54dc81b93805f86d19aa46 100644 (file)
--- a/http-push.c
+++ b/http-push.c
#include "blob.h"
#include "http.h"
#include "refs.h"
+#include "diff.h"
#include "revision.h"
#include "exec_cmd.h"
diff --git a/rev-list.c b/rev-list.c
index 359195b5471d8e4b88fd9a326986e55d48b1dfa6..963707a495092405c3eb5b155c195b2968afdac7 100644 (file)
--- a/rev-list.c
+++ b/rev-list.c
#include "tree.h"
#include "blob.h"
#include "tree-walk.h"
+#include "diff.h"
#include "revision.h"
/* bits #0-6 in revision.h */
diff --git a/revision.c b/revision.c
index 634f9a5ccb9b7a21571cb37ce4bad3ae80d4d436..0505f3f455151ac2fafc7fe2df2e6fd147d20f08 100644 (file)
--- a/revision.c
+++ b/revision.c
tree_difference = REV_TREE_DIFFERENT;
}
-static struct diff_options diff_opt = {
- .recursive = 1,
- .add_remove = file_add_remove,
- .change = file_change,
-};
-
-int rev_compare_tree(struct tree *t1, struct tree *t2)
+int rev_compare_tree(struct rev_info *revs, struct tree *t1, struct tree *t2)
{
if (!t1)
return REV_TREE_NEW;
if (!t2)
return REV_TREE_DIFFERENT;
tree_difference = REV_TREE_SAME;
- if (diff_tree_sha1(t1->object.sha1, t2->object.sha1, "", &diff_opt) < 0)
+ if (diff_tree_sha1(t1->object.sha1, t2->object.sha1, "",
+ &revs->diffopt) < 0)
return REV_TREE_DIFFERENT;
return tree_difference;
}
-int rev_same_tree_as_empty(struct tree *t1)
+int rev_same_tree_as_empty(struct rev_info *revs, struct tree *t1)
{
int retval;
void *tree;
empty.size = 0;
tree_difference = 0;
- retval = diff_tree(&empty, &real, "", &diff_opt);
+ retval = diff_tree(&empty, &real, "", &revs->diffopt);
free(tree);
return retval >= 0 && !tree_difference;
@@ -284,7 +279,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
return;
if (!commit->parents) {
- if (!rev_same_tree_as_empty(commit->tree))
+ if (!rev_same_tree_as_empty(revs, commit->tree))
commit->object.flags |= TREECHANGE;
return;
}
@@ -294,7 +289,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
struct commit *p = parent->item;
parse_commit(p);
- switch (rev_compare_tree(p->tree, commit->tree)) {
+ switch (rev_compare_tree(revs, p->tree, commit->tree)) {
case REV_TREE_SAME:
if (p->object.flags & UNINTERESTING) {
/* Even if a merge with an uninteresting
@@ -312,7 +307,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
case REV_TREE_NEW:
if (revs->remove_empty_trees &&
- rev_same_tree_as_empty(p->tree)) {
+ rev_same_tree_as_empty(revs, p->tree)) {
/* We are adding all the specified
* paths from this parent, so the
* history beyond this parent is not
void init_revisions(struct rev_info *revs)
{
memset(revs, 0, sizeof(*revs));
+ revs->diffopt.recursive = 1;
+ revs->diffopt.add_remove = file_add_remove;
+ revs->diffopt.change = file_change;
revs->lifo = 1;
revs->dense = 1;
revs->prefix = setup_git_directory();
@@ -707,7 +705,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
revs->limited = 1;
if (revs->prune_data) {
- diff_tree_setup_paths(revs->prune_data, &diff_opt);
+ diff_tree_setup_paths(revs->prune_data, &revs->diffopt);
revs->prune_fn = try_to_simplify_commit;
}
diff --git a/revision.h b/revision.h
index 83d28d520557ae37eea59dd7446e46edb6ef7cf6..8970b57e3c7e2ca8d213258f1befb84ac06e3a13 100644 (file)
--- a/revision.h
+++ b/revision.h
unsigned long max_age;
unsigned long min_age;
+ /* paths limiting */
+ struct diff_options diffopt;
+
topo_sort_set_fn_t topo_setter;
topo_sort_get_fn_t topo_getter;
};
#define REV_TREE_DIFFERENT 2
/* revision.c */
-extern int rev_same_tree_as_empty(struct tree *t1);
-extern int rev_compare_tree(struct tree *t1, struct tree *t2);
+extern int rev_same_tree_as_empty(struct rev_info *, struct tree *t1);
+extern int rev_compare_tree(struct rev_info *, struct tree *t1, struct tree *t2);
extern void init_revisions(struct rev_info *revs);
extern int setup_revisions(int argc, const char **argv, struct rev_info *revs, const char *def);