From mboxrd@z Thu Jan 1 00:00:00 1970 From: cgit at cryptocrack.de (Lukas Fleischer) Date: Sun, 04 May 2014 22:03:13 +0200 Subject: [PATCH 1/1] git: update for git 2.0 In-Reply-To: <1399231899-16189-1-git-send-email-mail@eworm.de> References: <1399231899-16189-1-git-send-email-mail@eworm.de> Message-ID: <20140504200313.13342.67443@typhoon.lan> On Sun, 04 May 2014 at 21:31:39, Christian Hesse wrote: > prefixcmp() and suffixcmp() have been remove, functionality is now > provided by starts_with() and ends_with(). Retrurn values have been > changed, so instead of just renaming we have to fix logic. > Everything else looks just fine. > --- > Makefile | 4 ++-- > cgit.c | 26 +++++++++++++------------- > git | 2 +- > parsing.c | 12 ++++++------ > scan-tree.c | 10 +++++++--- > ui-clone.c | 2 +- > ui-log.c | 8 ++++---- > ui-refs.c | 6 +++--- > ui-repolist.c | 2 +- > ui-shared.c | 2 +- > ui-snapshot.c | 4 ++-- > ui-summary.c | 2 +- > 12 files changed, 42 insertions(+), 38 deletions(-) > > [...] > - else if (!prefixcmp(name, "module-link.")) { > + else if (starts_with(name, "module-link.")) { > item = string_list_append(&repo->submodules, xstrdup(name + 12)); My original intention was to replace most of these with skip_prefix() (well, I actually wanted to wait for strip_prefix() to replace skip_prefix() but that didn't make it into Git 2.0). It would be great to see most of the starts_with() invocations (followed by hardcoded lengths) replaced by skip_prefix() but if you don't want to do it, I guess this change is okay for now. > item->util = xstrdup(value); > } else if (!strcmp(name, "section")) > @@ -102,7 +102,7 @@ static void config_cb(const char *name, const char *value) > ctx.repo = cgit_add_repo(value); > else if (ctx.repo && !strcmp(name, "repo.path")) > ctx.repo->path = trim_end(value, '/'); > - else if (ctx.repo && !prefixcmp(name, "repo.")) > + else if (ctx.repo && starts_with(name, "repo.")) > repo_config(ctx.repo, name + 5, value); > else if (!strcmp(name, "readme") && value != NULL) > string_list_append(&ctx.cfg.readme, xstrdup(value)); > @@ -264,7 +264,7 @@ static void config_cb(const char *name, const char *value) > [...]