[PATCH] Fix building with git 1.7.6.

Andreas Schneider asn at cryptomilk.org
Thu Aug 4 16:27:41 CEST 2011


---
 shared.c   |   11 ++++++-----
 ui-stats.c |    2 +-
 ui-tree.c  |    6 +++++-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/shared.c b/shared.c
index 699c362..a717e65 100644
--- a/shared.c
+++ b/shared.c
@@ -306,7 +306,7 @@ void cgit_diff_tree(const unsigned char *old_sha1,
 		    filepair_fn fn, const char *prefix, int ignorews)
 {
 	struct diff_options opt;
-	int prefixlen;
+	struct pathspec_item pitem;
 
 	diff_setup(&opt);
 	opt.output_format = DIFF_FORMAT_CALLBACK;
@@ -318,10 +318,11 @@ void cgit_diff_tree(const unsigned char *old_sha1,
 	opt.format_callback = cgit_diff_tree_cb;
 	opt.format_callback_data = fn;
 	if (prefix) {
-		opt.nr_paths = 1;
-		opt.paths = &prefix;
-		prefixlen = strlen(prefix);
-		opt.pathlens = &prefixlen;
+		opt.pathspec.nr = 1;
+		opt.pathspec.raw = &prefix;
+		pitem.match = prefix;
+		pitem.len = strlen(prefix);
+		opt.pathspec.items = &pitem;
 	}
 	diff_setup_done(&opt);
 
diff --git a/ui-stats.c b/ui-stats.c
index 59f4c1e..51dd6a2 100644
--- a/ui-stats.c
+++ b/ui-stats.c
@@ -239,7 +239,7 @@ struct string_list collect_stats(struct cgit_context *ctx,
 	init_revisions(&rev, NULL);
 	rev.abbrev = DEFAULT_ABBREV;
 	rev.commit_format = CMIT_FMT_DEFAULT;
-	rev.no_merges = 1;
+	rev.max_parents = 1;
 	rev.verbose_header = 1;
 	rev.show_root_diff = 0;
 	setup_revisions(argc, argv, &rev, NULL);
diff --git a/ui-tree.c b/ui-tree.c
index 442b6be..16a1d44 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -206,6 +206,8 @@ static void ls_tail()
 
 static void ls_tree(const unsigned char *sha1, char *path)
 {
+	const char *paths[] = { path, NULL };
+	struct pathspec pathspec;
 	struct tree *tree;
 
 	tree = parse_tree_indirect(sha1);
@@ -216,7 +218,9 @@ static void ls_tree(const unsigned char *sha1, char *path)
 	}
 
 	ls_head();
-	read_tree_recursive(tree, "", 0, 1, NULL, ls_item, NULL);
+	init_pathspec(&pathspec, paths);
+	read_tree_recursive(tree, "", 0, 1, &pathspec, ls_item, NULL);
+	free_pathspec(&pathspec);
 	ls_tail();
 }
 
-- 
1.7.6






More information about the CGit mailing list