From 402f09ab38d38df9eea7d7fff840f94cae0e742eb8dadd7ca048927afa54d7b7 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Mon, 28 Nov 2011 15:36:51 +0000 Subject: [PATCH] Accepting request 94123 from home:olta:haiku-admin Add cgit-fix-more-read_tree_recursive.diff, this time with 'Changed'-entry. OBS-URL: https://build.opensuse.org/request/show/94123 OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/cgit?expand=0&rev=11 --- ...-more-read_tree_recursive-invocations.diff | 54 +++++++++++++++++++ cgit.changes | 12 +++++ cgit.spec | 2 + 3 files changed, 68 insertions(+) create mode 100644 cgit-fix-more-read_tree_recursive-invocations.diff diff --git a/cgit-fix-more-read_tree_recursive-invocations.diff b/cgit-fix-more-read_tree_recursive-invocations.diff new file mode 100644 index 0000000..60d42b5 --- /dev/null +++ b/cgit-fix-more-read_tree_recursive-invocations.diff @@ -0,0 +1,54 @@ +--- ui-blob.c ++++ ui-blob.c +@@ -37,11 +37,14 @@ int cgit_print_file(char *path, const char *head) + return -1; + type = sha1_object_info(sha1, &size); + if(type == OBJ_COMMIT && path) { ++ struct pathspec pathspec; + commit = lookup_commit_reference(sha1); + match_path = path; + matched_sha1 = sha1; + found_path = 0; +- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); ++ init_pathspec(&pathspec, paths); ++ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL); ++ free_pathspec(&pathspec); + if (!found_path) + return -1; + type = sha1_object_info(sha1, &size); +@@ -80,10 +83,13 @@ void cgit_print_blob(const char *hex, char *path, const char *head) + type = sha1_object_info(sha1, &size); + + if((!hex) && type == OBJ_COMMIT && path) { ++ struct pathspec pathspec; + commit = lookup_commit_reference(sha1); + match_path = path; + matched_sha1 = sha1; +- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); ++ init_pathspec(&pathspec, paths); ++ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL); ++ free_pathspec(&pathspec); + type = sha1_object_info(sha1,&size); + } + +--- ui-plain.c ++++ ui-plain.c +@@ -145,6 +145,7 @@ void cgit_print_plain(struct cgit_context *ctx) + unsigned char sha1[20]; + struct commit *commit; + const char *paths[] = {ctx->qry.path, NULL}; ++ struct pathspec pathspec; + + if (!rev) + rev = ctx->qry.head; +@@ -165,7 +166,9 @@ void cgit_print_plain(struct cgit_context *ctx) + } + else + match_baselen = basedir_len(paths[0]); +- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); ++ init_pathspec(&pathspec, paths); ++ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL); ++ free_pathspec(&pathspec); + if (!match) + html_status(404, "Not found", 0); + else if (match == 2) diff --git a/cgit.changes b/cgit.changes index 5fc9496..dea8d90 100644 --- a/cgit.changes +++ b/cgit.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Nov 28 14:04:00 CET 2011 - zooey@hirschkaefer.de + +- Add patch cgit-fix-more-read_tree_recursive-invocations.diff: + + There are more incorrect invocations of read_tree_recursive(), + one example can be seen when visiting one of the 'plain' links + in the tree view (contents of the wrong file are shown). + + This time I did what I should have done last time and checked + and adjusted all invocations of read_tree_recursive(). + ------------------------------------------------------------------- Tue Nov 22 09:24:35 UTC 2011 - saschpe@suse.de diff --git a/cgit.spec b/cgit.spec index 22c4079..01ae051 100644 --- a/cgit.spec +++ b/cgit.spec @@ -34,6 +34,7 @@ Patch: cgit-optflags.diff Patch1: cgit-git-1.7.6_build_fix.patch Patch2: cgit-CVE-2011-2711-fix.diff Patch3: cgit-fix-print-tree.diff +Patch4: cgit-fix-more-read_tree_recursive-invocations.diff # Requirements for cgit BuildRequires: gnu-crypto libopenssl-devel libzip-devel # Requirements for cgitrc man page generation @@ -55,6 +56,7 @@ Authors: %patch1 -p1 %patch2 -p1 %patch3 +%patch4 rm -rf git mv git-%{git_version} git