From dakkar at thenautilus.net Fri Mar 25 21:08:16 2022 From: dakkar at thenautilus.net (Gianni Ceccarelli) Date: Fri, 25 Mar 2022 21:08:16 +0000 Subject: Weird interactions betwen cache and module-link Message-ID: <20220325210816.6f89abb3@thenautilus.net> Hello! I use git submodules pretty often, and I like that cgit allows me to link them to their proper repository. For example, https://www.thenautilus.net/cgit/env-sensor/tree/ or https://www.thenautilus.net/cgit/lego-piano/tree/ You may have noticed that at least one of those pages does not show links for the sub-modules. If I disable the cache (``cache-size=0``), all pages show all configured module-links, reliably. If I enable the cache (``cache-size=1000``, no other cache-related setting in the ``/etc/cgitrc`` file), then the *first* page I access shows the correct links (if it has any), but subsequent ones don't. This is cgit 1.2.3 with a one-line patch to compare sub-module names case-insensitively (``ret->submodules.cmp = strcasecmp`` inside ``cgit_add_repo``) which I'm pretty sure shouldn't create the problem I'm seeing. One thing I've noticed is that cgit caches all repositories' configuration in a single file, and that file does not include any ``module-link`` line. If cgit reads the configuration directly in the absence of this single file, but reads only this file if it's present, that would explain the observed behaviour. Does the code that serialises the configuration to the cache need to be taught about ``module-link`` (and maybe other settings)? Thanks! -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 From dakkar at thenautilus.net Fri Mar 25 21:44:48 2022 From: dakkar at thenautilus.net (Gianni Ceccarelli) Date: Fri, 25 Mar 2022 21:44:48 +0000 Subject: Weird interactions betwen cache and module-link In-Reply-To: <20220325210816.6f89abb3@thenautilus.net> References: <20220325210816.6f89abb3@thenautilus.net> Message-ID: <20220325214448.244a6590@thenautilus.net> This patch seems to fix the problem. diff --git c/cgit.c w/cgit.c index 08d81a1..d30e259 100644 --- c/cgit.c +++ w/cgit.c @@ -810,6 +810,10 @@ static void print_repo(FILE *f, struct cgit_repo *repo) fprintf(f, "repo.extra-head-content=%s\n", repo->extra_head_content); if (repo->module_link) fprintf(f, "repo.module-link=%s\n", repo->module_link); + for (int i = 0; i < repo->submodules.nr; ++i) { + struct string_list_item *si=&repo->submodules.items[i]; + fprintf(f, "repo.module-link.%s=%s\n", si->string, (char*)si->util); + } if (repo->section) fprintf(f, "repo.section=%s\n", repo->section); if (repo->homepage) -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 From john at keeping.me.uk Sat Mar 26 10:30:41 2022 From: john at keeping.me.uk (John Keeping) Date: Sat, 26 Mar 2022 10:30:41 +0000 Subject: Weird interactions betwen cache and module-link In-Reply-To: <20220325214448.244a6590@thenautilus.net> References: <20220325210816.6f89abb3@thenautilus.net> <20220325214448.244a6590@thenautilus.net> Message-ID: On Fri, Mar 25, 2022 at 09:44:48PM +0000, Gianni Ceccarelli wrote: > This patch seems to fix the problem. Nice catch! This definitely looks like an oversight. Would you like to type up a proper patch with a commit message and Signed-off-by certification? We use the same process as git.git so their SubmittingPatches document [1] explains this. [1] https://git-scm.com/docs/SubmittingPatches#sign-off > diff --git c/cgit.c w/cgit.c > index 08d81a1..d30e259 100644 > --- c/cgit.c > +++ w/cgit.c > @@ -810,6 +810,10 @@ static void print_repo(FILE *f, struct cgit_repo *repo) > fprintf(f, "repo.extra-head-content=%s\n", repo->extra_head_content); > if (repo->module_link) > fprintf(f, "repo.module-link=%s\n", repo->module_link); > + for (int i = 0; i < repo->submodules.nr; ++i) { > + struct string_list_item *si=&repo->submodules.items[i]; > + fprintf(f, "repo.module-link.%s=%s\n", si->string, (char*)si->util); > + } > if (repo->section) > fprintf(f, "repo.section=%s\n", repo->section); > if (repo->homepage) > > > -- > Dakkar - > GPG public key fingerprint = A071 E618 DD2C 5901 9574 > 6FE2 40EA 9883 7519 3F88 > key id = 0x75193F88 > From dakkar at thenautilus.net Sat Mar 26 10:44:12 2022 From: dakkar at thenautilus.net (Gianni Ceccarelli) Date: Sat, 26 Mar 2022 10:44:12 +0000 Subject: Weird interactions betwen cache and module-link In-Reply-To: References: <20220325210816.6f89abb3@thenautilus.net> <20220325214448.244a6590@thenautilus.net> Message-ID: <20220326104412.22146718@nautilus> On 2022-03-26 John Keeping wrote: > Would you like to type up a proper patch with a commit message and > Signed-off-by certification? Sure! Patch attached. -- Dakkar - GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88 -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-cgit.c-teach-repo-config-printing-about-per-path-mod.patch Type: text/x-patch Size: 1050 bytes Desc: not available URL: From piercebrands at gmail.com Mon Mar 28 13:43:56 2022 From: piercebrands at gmail.com (Brands Pierce) Date: Mon, 28 Mar 2022 21:43:56 +0800 Subject: Problems about git pull & git push Message-ID: Recently I set up a private git server locally using cgit. But encountered some problems: 1. Create an empty public repository on the server, and git pull prompts: PS C:\Users\piercebrands\projects> git clone http://git.localhost.obiscr.com/myrepo.git Cloning into 'myrepo'... fatal: http://git.localhost.obiscr.com/myrepo.git/info/refs not valid: is this a git repository? 2. Create a new warehouse locally, push it to origin, and prompt: PS C:\Users\piercebrands\projects\myrepo> git remote add origin git at git.localhost.obiscr.com:/repos/myrepo.git PS C:\Users\piercebrands\projects\myrepo> git push origin master error: src refspec master does not match any error: failed to push some refs to '192.168.137.39:/repos/myrepo.git' When I use the browser to access the git server directly without any problem, the code highlighting, filters, etc. are all working fine. Don't know where the problem is. Thanks!