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>
This commit is contained in:
Christian Hesse 2015-02-07 14:18:28 +01:00 committed by Jason A. Donenfeld
parent 1a9e56607e
commit 7358f63015
6 changed files with 20 additions and 24 deletions

View File

@ -14,7 +14,7 @@ htmldir = $(docdir)
pdfdir = $(docdir) pdfdir = $(docdir)
mandir = $(prefix)/share/man mandir = $(prefix)/share/man
SHA1_HEADER = <openssl/sha.h> 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 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.gz
INSTALL = install INSTALL = install
COPYTREE = cp -r COPYTREE = cp -r

2
cgit.c
View File

@ -603,7 +603,7 @@ static int prepare_repo_cmd(void)
free(tmp); free(tmp);
return 1; return 1;
} }
sort_string_list(&ctx.repo->submodules); string_list_sort(&ctx.repo->submodules);
cgit_prepare_repo_env(ctx.repo); cgit_prepare_repo_env(ctx.repo);
choose_readme(ctx.repo); choose_readme(ctx.repo);
return 0; return 0;

2
git

@ -1 +1 @@
Subproject commit fdf96a20acf96a6ac538df8113b2aafd6ed71d50 Subproject commit 9874fca7122563e28d699a911404fc49d2a24f1c

View File

@ -18,15 +18,15 @@ struct walk_tree_context {
int file_only:1; int file_only:1;
}; };
static int walk_tree(const unsigned char *sha1, const char *base, int baselen, static int walk_tree(const unsigned char *sha1, struct strbuf *base,
const char *pathname, unsigned mode, int stage, void *cbdata) const char *pathname, unsigned mode, int stage, void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
if (walk_tree_ctx->file_only && !S_ISREG(mode)) if (walk_tree_ctx->file_only && !S_ISREG(mode))
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;
if (strncmp(base, walk_tree_ctx->match_path, baselen) if (strncmp(base->buf, walk_tree_ctx->match_path, base->len)
|| strcmp(walk_tree_ctx->match_path + baselen, pathname)) || strcmp(walk_tree_ctx->match_path + base->len, pathname))
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;
memmove(walk_tree_ctx->matched_sha1, sha1, 20); memmove(walk_tree_ctx->matched_sha1, sha1, 20);
walk_tree_ctx->found_path = 1; walk_tree_ctx->found_path = 1;

View File

@ -173,23 +173,22 @@ static void print_dir_tail(void)
html(" </ul>\n</body></html>\n"); html(" </ul>\n</body></html>\n");
} }
static int walk_tree(const unsigned char *sha1, const char *base, int baselen, static int walk_tree(const unsigned char *sha1, struct strbuf *base,
const char *pathname, unsigned mode, int stage, const char *pathname, unsigned mode, int stage, void *cbdata)
void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = 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 (S_ISREG(mode)) {
if (print_object(sha1, pathname)) if (print_object(sha1, pathname))
walk_tree_ctx->match = 1; walk_tree_ctx->match = 1;
} else if (S_ISDIR(mode)) { } else if (S_ISDIR(mode)) {
print_dir(sha1, base, baselen, pathname); print_dir(sha1, base->buf, base->len, pathname);
walk_tree_ctx->match = 2; walk_tree_ctx->match = 2;
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;
} }
} else if (baselen > walk_tree_ctx->match_baselen) { } else if (base->len > walk_tree_ctx->match_baselen) {
print_dir_entry(sha1, base, baselen, pathname, mode); print_dir_entry(sha1, base->buf, base->len, pathname, mode);
walk_tree_ctx->match = 2; walk_tree_ctx->match = 2;
} else if (S_ISDIR(mode)) { } else if (S_ISDIR(mode)) {
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;

View File

@ -121,9 +121,8 @@ static void print_object(const unsigned char *sha1, char *path, const char *base
} }
static int ls_item(const unsigned char *sha1, const char *base, int baselen, static int ls_item(const unsigned char *sha1, struct strbuf *base,
const char *pathname, unsigned int mode, int stage, const char *pathname, unsigned mode, int stage, void *cbdata)
void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
char *name; char *name;
@ -216,16 +215,15 @@ static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_cont
} }
static int walk_tree(const unsigned char *sha1, const char *base, int baselen, static int walk_tree(const unsigned char *sha1, struct strbuf *base,
const char *pathname, unsigned mode, int stage, const char *pathname, unsigned mode, int stage, void *cbdata)
void *cbdata)
{ {
struct walk_tree_context *walk_tree_ctx = cbdata; struct walk_tree_context *walk_tree_ctx = cbdata;
static char buffer[PATH_MAX]; static char buffer[PATH_MAX];
if (walk_tree_ctx->state == 0) { if (walk_tree_ctx->state == 0) {
memcpy(buffer, base, baselen); memcpy(buffer, base->buf, base->len);
strcpy(buffer + baselen, pathname); strcpy(buffer + base->len, pathname);
if (strcmp(walk_tree_ctx->match_path, buffer)) if (strcmp(walk_tree_ctx->match_path, buffer))
return READ_TREE_RECURSIVE; return READ_TREE_RECURSIVE;
@ -238,11 +236,10 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen,
return 0; 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; return 0;
} }
/* /*
* Show a tree or a blob * Show a tree or a blob
* rev: the commit pointing at the root tree object * rev: the commit pointing at the root tree object