cgit

commit 7358f63015a27d1c22816a3c1f734c3d4beed115

Author: Christian Hesse <mail@eworm.de>

git: update for v2.3.0

* sort_string_list(): rename to string_list_sort() (upstream commit
  3383e199)
* update read_tree_recursive callback to pass strbuf as base (upstream
  commit 6a0b0b6d)

Signed-off-by: Christian Hesse <mail@eworm.de>

 Makefile | 2 +-
 cgit.c | 2 +-
 ui-blob.c | 8 ++++----
 ui-plain.c | 13 ++++++-------
 ui-tree.c | 17 +++++++----------


diff --git a/Makefile b/Makefile
index 2ff8a902e492343000c0dcb1ca603d6d2caef817..36977959acbe811f056beebbf30e979a49e26cb0 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ htmldir = $(docdir)
 pdfdir = $(docdir)
 mandir = $(prefix)/share/man
 SHA1_HEADER = <openssl/sha.h>
-GIT_VER = 2.2.2
+GIT_VER = 2.3.0
 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
 INSTALL = install
 COPYTREE = cp -r




diff --git a/cgit.c b/cgit.c
index 431e325295610ba5eeeff1ce3cdb1954f3012215..02ddddaa2bf669b3d65dd4f5570a013a8f1a7dd7 100644
--- a/cgit.c
+++ b/cgit.c
@@ -603,7 +603,7 @@ 		cgit_print_docend();
 		free(tmp);
 		return 1;
 	}
-	sort_string_list(&ctx.repo->submodules);
+	string_list_sort(&ctx.repo->submodules);
 	cgit_prepare_repo_env(ctx.repo);
 	choose_readme(ctx.repo);
 	return 0;








diff --git a/ui-blob.c b/ui-blob.c
index c2de8d6be0eb9d89ef53d8eaebbf060d781153ee..a025bca5d8f501ded7e6da6d7ea6965485e3f75f 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -18,15 +18,15 @@ 	int found_path:1;
 	int file_only:1;
 };
 
-static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
-	const char *pathname, unsigned mode, int stage, void *cbdata)
+static int walk_tree(const unsigned char *sha1, struct strbuf *base,
+		const char *pathname, unsigned mode, int stage, void *cbdata)
 {
 	struct walk_tree_context *walk_tree_ctx = cbdata;
 
 	if (walk_tree_ctx->file_only && !S_ISREG(mode))
 		return READ_TREE_RECURSIVE;
-	if (strncmp(base, walk_tree_ctx->match_path, baselen)
-		|| strcmp(walk_tree_ctx->match_path + baselen, pathname))
+	if (strncmp(base->buf, walk_tree_ctx->match_path, base->len)
+		|| strcmp(walk_tree_ctx->match_path + base->len, pathname))
 		return READ_TREE_RECURSIVE;
 	memmove(walk_tree_ctx->matched_sha1, sha1, 20);
 	walk_tree_ctx->found_path = 1;




diff --git a/ui-plain.c b/ui-plain.c
index 30fff8919a3e35572523a6fbb74533c8f8992887..b787bc3c776b01587c297a211cb1e3638eb6de66 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -173,23 +173,22 @@ {
 	html(" </ul>\n</body></html>\n");
 }
 
-static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
-		     const char *pathname, unsigned mode, int stage,
-		     void *cbdata)
+static int walk_tree(const unsigned char *sha1, struct strbuf *base,
+		const char *pathname, unsigned mode, int stage, void *cbdata)
 {
 	struct walk_tree_context *walk_tree_ctx = cbdata;
 
-	if (baselen == walk_tree_ctx->match_baselen) {
+	if (base->len == walk_tree_ctx->match_baselen) {
 		if (S_ISREG(mode)) {
 			if (print_object(sha1, pathname))
 				walk_tree_ctx->match = 1;
 		} else if (S_ISDIR(mode)) {
-			print_dir(sha1, base, baselen, pathname);
+			print_dir(sha1, base->buf, base->len, pathname);
 			walk_tree_ctx->match = 2;
 			return READ_TREE_RECURSIVE;
 		}
-	} else if (baselen > walk_tree_ctx->match_baselen) {
-		print_dir_entry(sha1, base, baselen, pathname, mode);
+	} else if (base->len > walk_tree_ctx->match_baselen) {
+		print_dir_entry(sha1, base->buf, base->len, pathname, mode);
 		walk_tree_ctx->match = 2;
 	} else if (S_ISDIR(mode)) {
 		return READ_TREE_RECURSIVE;




diff --git a/ui-tree.c b/ui-tree.c
index e4c3d2263cb3b85e84066ed4f0bfb6640bdcbe0a..4ab01372e7bacd44b1601ad8b5a5e6a84f9f6b47 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -121,9 +121,8 @@ 		print_text_buffer(basename, buf, size);
 }
 
 
-static int ls_item(const unsigned char *sha1, const char *base, int baselen,
-		   const char *pathname, unsigned int mode, int stage,
-		   void *cbdata)
+static int ls_item(const unsigned char *sha1, struct strbuf *base,
+		const char *pathname, unsigned mode, int stage, void *cbdata)
 {
 	struct walk_tree_context *walk_tree_ctx = cbdata;
 	char *name;
@@ -216,16 +215,15 @@ 	ls_tail();
 }
 
 
-static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
-		     const char *pathname, unsigned mode, int stage,
-		     void *cbdata)
+static int walk_tree(const unsigned char *sha1, struct strbuf *base,
+		const char *pathname, unsigned mode, int stage, void *cbdata)
 {
 	struct walk_tree_context *walk_tree_ctx = cbdata;
 	static char buffer[PATH_MAX];
 
 	if (walk_tree_ctx->state == 0) {
-		memcpy(buffer, base, baselen);
-		strcpy(buffer + baselen, pathname);
+		memcpy(buffer, base->buf, base->len);
+		strcpy(buffer + base->len, pathname);
 		if (strcmp(walk_tree_ctx->match_path, buffer))
 			return READ_TREE_RECURSIVE;
 
@@ -238,10 +236,9 @@ 			print_object(sha1, buffer, pathname, walk_tree_ctx->curr_rev);
 			return 0;
 		}
 	}
-	ls_item(sha1, base, baselen, pathname, mode, stage, walk_tree_ctx);
+	ls_item(sha1, base, pathname, mode, stage, walk_tree_ctx);
 	return 0;
 }
-
 
 /*
  * Show a tree or a blob