From list at eworm.de Tue Oct 4 05:27:05 2022 From: list at eworm.de (Christian Hesse) Date: Tue, 4 Oct 2022 07:27:05 +0200 Subject: [PATCH 1/1] git: update to v2.38.0 Message-ID: <20221004052705.19481-1-list@eworm.de> From: Christian Hesse Update to git version v2.38.0, no additional changes required. Signed-off-by: Christian Hesse --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6928e16..e71be39 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ htmldir = $(docdir) pdfdir = $(docdir) mandir = $(prefix)/share/man SHA1_HEADER = -GIT_VER = 2.37.3 +GIT_VER = 2.38.0 GIT_URL = https://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.xz INSTALL = install COPYTREE = cp -r diff --git a/git b/git index ac8035a..3dcec76 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit ac8035a2affdf30f2c691ad760826d955bba0507 +Subproject commit 3dcec76d9df911ed8321007b1d197c1a206dc164 -- 2.38.0 From konstantin at linuxfoundation.org Fri Oct 7 17:25:28 2022 From: konstantin at linuxfoundation.org (Konstantin Ryabitsev) Date: Fri, 7 Oct 2022 13:25:28 -0400 Subject: RFE: commit git-patch-id lookup links Message-ID: <20221007172528.4ryaoc26wwtsetdw@meerkat.local> Hi, all: One of the recent additions to public-inbox was auto-indexing of patches by their patch-id (see git-patch-id.1). This allows to see a history of many commits through public-inbox discussions. Using a random commit as an example: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4dc45b1848bc6bcac31eb1b4ccdd7f6718b3c86 We can convert it to a patch-id and look up its history: $ echo "https://lore.kernel.org/all/?q=patchid:$(git show e4dc45b1848 | git patch-id --stable | awk '{print $1}')" https://lore.kernel.org/all/?q=patchid:d91c951338cfe9f06e8b8aa74856f6dc08ac8212 It would be nice to have this feature in cgit: 1. add "patch-id-query-url" parameter, e.g.: patch-id-query-url=https://lore.kernel.org/all/?q=patchid:%s 2. when defined, commit views would add another entry in the header table: code-review patchid:${patchid}
This would only make sense for non-merge commits (i.e. those with fewer than 2 parents). Thoughts? -K From e at 80x24.org Fri Oct 7 21:14:49 2022 From: e at 80x24.org (Eric Wong) Date: Fri, 7 Oct 2022 21:14:49 +0000 Subject: RFE: commit git-patch-id lookup links In-Reply-To: <20221007172528.4ryaoc26wwtsetdw@meerkat.local> References: <20221007172528.4ryaoc26wwtsetdw@meerkat.local> Message-ID: <20221007211449.M581921@dcvr> Konstantin Ryabitsev wrote: > Hi, all: > > One of the recent additions to public-inbox was auto-indexing of patches by > their patch-id (see git-patch-id.1). This allows to see a history of many > commits through public-inbox discussions. Using a random commit as an example: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4dc45b1848bc6bcac31eb1b4ccdd7f6718b3c86 > > We can convert it to a patch-id and look up its history: > > $ echo "https://lore.kernel.org/all/?q=patchid:$(git show e4dc45b1848 | git patch-id --stable | awk '{print $1}')" > https://lore.kernel.org/all/?q=patchid:d91c951338cfe9f06e8b8aa74856f6dc08ac8212 Fwiw, patchid: doesn't account for some cases where non-standard options are used for generating patches (e.g. -W, -U). Admittedly they're rare cases... I've been favoring searches for postimage blob IDs (since pre-patchid in public-inbox), possibly combined with Subject: phrase matches. Fwiw, public-inbox can show git commits and prefill search forms: https://public-inbox.org/git/d1e76d5ddcacdfc76bc247e7594e3fbaaa5ea9cc/s/ the top search form has `patchid:' pre-filled, and the form below the patch has `dfblob:' pre-filled. Subject (`s:') isn't pre-filled, yet (haven't decided how to signify that's optional in the UI). From vegard.nossum at oracle.com Mon Oct 17 11:50:04 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 13:50:04 +0200 Subject: git notes for the Linux kernel Message-ID: <20221017115010.21977-1-vegard.nossum@oracle.com> Hi cgit maintainers, I've improved the support for git notes in cgit, including the ability to load notes from a separate repository than the one you are viewing. My use case is using a separate repository of git notes for the Linux kernel to annotate commits with extra cross-referencing information such as e.g.: - lore links to patch submissions matching the patch, - references to subsequent fixes (if the current commit is buggy) - mitre links to CVEs - references to backports in stable/LTS My hope is that these notes can eventually be displayed on git.kernel.org -- at least, we've found the notes invaluable and a huge time saver in different types of kernel work. (I'm still in the process of working out how to release these notes and/or the scripts generating them, but that's a different topic.) I tried to submit the git.git patches upstream, but they were rejected by the maintainer for not being general enough: https://lore.kernel.org/git/20220802075401.2393-1-vegard.nossum at oracle.com/ I will unfortunately not be able to implement the git maintainer's suggestion, so I'll just offer up my git and cgit patches here, in case cgit would still like this functionality; it would mean having to maintain and carry the extra 2 git.git patches. I would be happy to continue forward-porting those patches, however, as this is something I will need to do for our internal use anyway. Here is a screenshot of cgit with Linux kernel notes in action: https://vegard.github.io/cgit/6399f1fae4ec.png cgit patches will follow in replies to this email -- the two prerequisite git.git patches are available at the git mailing list link above and should apply cleanly to v2.38.0. Thanks, Vegard From vegard.nossum at oracle.com Mon Oct 17 11:50:05 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 13:50:05 +0200 Subject: [PATCH 1/6] Support notes from external repositories In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: <20221017115010.21977-2-vegard.nossum@oracle.com> Before this commit, all git notes had to be part of the repository that the notes are displayed for. This adds an option to display notes from an external repository. Signed-off-by: Vegard Nossum --- cgit.c | 27 ++++++++++++++++++++++++++- cgit.h | 2 ++ cgitrc.5.txt | 8 ++++++++ shared.c | 2 ++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index 08d81a1..dc6b491 100644 --- a/cgit.c +++ b/cgit.c @@ -107,6 +107,10 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->hide = atoi(value); else if (!strcmp(name, "ignore")) repo->ignore = atoi(value); + else if (!strcmp(name, "notes_repo")) + repo->notes_repo = xstrdup(value); + else if (!strcmp(name, "notes_ref")) + repo->notes_ref = xstrdup(value); else if (ctx.cfg.enable_filter_overrides) { if (!strcmp(name, "about-filter")) repo->about_filter = cgit_new_filter(value, ABOUT); @@ -570,6 +574,8 @@ static void print_no_repo_clone_urls(const char *url) html("\n"); } +static struct repository notes_repo; + static void prepare_repo_env(int *nongit) { /* The path to the git repository. */ @@ -579,7 +585,26 @@ static void prepare_repo_env(int *nongit) * load local configuration from the git repository, so we do them both while * the HOME variables are unset. */ setup_git_directory_gently(nongit); - load_display_notes(NULL); + + if (ctx.repo->notes_repo) { + if (repo_init(¬es_repo, ctx.repo->notes_repo, NULL) == 0) + add_to_alternates_memory(notes_repo.objects->odb->path); + } + + if (ctx.repo->notes_ref) { + struct display_notes_opt notes_opt; + + init_display_notes(¬es_opt); + notes_opt.use_default_notes = 0; + + if (ctx.repo->notes_repo) + notes_opt.repo = ¬es_repo; + + string_list_append(¬es_opt.extra_notes_refs, ctx.repo->notes_ref); + load_display_notes(¬es_opt); + } else { + load_display_notes(NULL); + } } static int prepare_repo_cmd(int nongit) diff --git a/cgit.h b/cgit.h index 69b5c13..50a5c73 100644 --- a/cgit.h +++ b/cgit.h @@ -113,6 +113,8 @@ struct cgit_repo { struct string_list submodules; int hide; int ignore; + char *notes_repo; + char *notes_ref; }; typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, diff --git a/cgitrc.5.txt b/cgitrc.5.txt index 33a6a8c..f3f31ee 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -562,6 +562,14 @@ repo.max-stats:: repo.name:: The value to show as repository name. Default value: . +repo.notes_ref:: + A ref or glob similar to the "notes.displayRef" git config option. + Default value: none. + +repo.notes_repo:: + If you want to use notes from an external repository, set this + option to the path of the repository. Default value: none. + repo.owner:: A value used to identify the owner of the repository. Default value: none. diff --git a/shared.c b/shared.c index 8115469..d3d0fa0 100644 --- a/shared.c +++ b/shared.c @@ -79,6 +79,8 @@ struct cgit_repo *cgit_add_repo(const char *url) ret->clone_url = ctx.cfg.clone_url; ret->submodules.strdup_strings = 1; ret->hide = ret->ignore = 0; + ret->notes_repo = NULL; + ret->notes_ref = NULL; return ret; } -- 2.35.1.46.g38062e73e0 From vegard.nossum at oracle.com Mon Oct 17 11:50:07 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 13:50:07 +0200 Subject: [PATCH 3/6] git: handle diff_queue_is_empty() changes In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: <20221017115010.21977-4-vegard.nossum@oracle.com> The newer git version this requires changes for these upstream commits: * 95433eeed9eac439eb21eb30105354b15e71302e diff: add ability to insert additional headers for paths Signed-off-by: Vegard Nossum --- ui-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui-log.c b/ui-log.c index 20774bf..4d7c48d 100644 --- a/ui-log.c +++ b/ui-log.c @@ -159,7 +159,8 @@ static int show_commit(struct commit *commit, struct rev_info *revs) "", &revs->diffopt); diffcore_std(&revs->diffopt); - found = !diff_queue_is_empty(); + struct diff_options diffopt = { NULL }; + found = !diff_queue_is_empty(&diffopt); saved_fmt = revs->diffopt.output_format; revs->diffopt.output_format = DIFF_FORMAT_CALLBACK; revs->diffopt.format_callback = cgit_diff_tree_cb; -- 2.35.1.46.g38062e73e0 From vegard.nossum at oracle.com Mon Oct 17 11:50:08 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 13:50:08 +0200 Subject: [PATCH 4/6] git: handle string_list_init_{nodup, dup}() changes for ctx.cfg.mimetypes In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: <20221017115010.21977-5-vegard.nossum@oracle.com> The newer git version this requires changes for these upstream commits: * bd4232fac3319890429ec303e2f7c3d287c8eaa3 Merge branch 'ab/struct-init' Signed-off-by: Vegard Nossum --- cgit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index dc6b491..e64694b 100644 --- a/cgit.c +++ b/cgit.c @@ -432,7 +432,7 @@ static void prepare_context(void) ctx.page.modified = time(NULL); ctx.page.expires = ctx.page.modified; ctx.page.etag = NULL; - string_list_init(&ctx.cfg.mimetypes, 1); + string_list_init_dup(&ctx.cfg.mimetypes); if (ctx.env.script_name) ctx.cfg.script_name = xstrdup(ctx.env.script_name); if (ctx.env.query_string) -- 2.35.1.46.g38062e73e0 From vegard.nossum at oracle.com Mon Oct 17 11:50:09 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 13:50:09 +0200 Subject: [PATCH 5/6] cgit: add extra alternates In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: <20221017115010.21977-6-vegard.nossum@oracle.com> This allows you to specify additional alternate repositories to be used with the given repository to resolve trees and commits. The main use for this is to be able to view commits that are not really part of the current repository. In our setup, we have an "all.git" which is really just an empty (bare) git repository with objects/info/alternates pointing to every other relevant repository (mainline, stable, etc.) which we then reference with this new config option. This is not strictly necessary for notes support, but makes it easier to linkify certain SHA1s in the notes if those commits are not usually available from the currently selected repository. Signed-off-by: Vegard Nossum --- cgit.c | 10 ++++++++++ cgit.h | 1 + cgitrc.5.txt | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/cgit.c b/cgit.c index e64694b..e6a94e1 100644 --- a/cgit.c +++ b/cgit.c @@ -111,6 +111,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->notes_repo = xstrdup(value); else if (!strcmp(name, "notes_ref")) repo->notes_ref = xstrdup(value); + else if (!strcmp(name, "alternates")) + string_list_append(&repo->alternates, xstrdup(value)); else if (ctx.cfg.enable_filter_overrides) { if (!strcmp(name, "about-filter")) repo->about_filter = cgit_new_filter(value, ABOUT); @@ -578,6 +580,8 @@ static struct repository notes_repo; static void prepare_repo_env(int *nongit) { + struct string_list_item *alternates_path; + /* The path to the git repository. */ setenv("GIT_DIR", ctx.repo->path, 1); @@ -605,6 +609,12 @@ static void prepare_repo_env(int *nongit) } else { load_display_notes(NULL); } + + for_each_string_list_item(alternates_path, &ctx.repo->alternates) { + struct repository *extra_repo = malloc(sizeof(*extra_repo)); + if (repo_init(extra_repo, alternates_path->string, NULL) == 0) + add_to_alternates_memory(extra_repo->objects->odb->path); + } } static int prepare_repo_cmd(int nongit) diff --git a/cgit.h b/cgit.h index 50a5c73..de5cd3d 100644 --- a/cgit.h +++ b/cgit.h @@ -115,6 +115,7 @@ struct cgit_repo { int ignore; char *notes_repo; char *notes_ref; + struct string_list alternates; }; typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, diff --git a/cgitrc.5.txt b/cgitrc.5.txt index f3f31ee..1be1922 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -456,6 +456,14 @@ repo.about-filter:: Override the default about-filter. Default value: none. See also: "enable-filter-overrides". See also: "FILTER API". +repo.alternates:: + Include additional repository object databases. This allows the + current repository to resolve commits from other repositories + (without includings its tags and branches), which is useful if you + want a single path that can resolve SHA1s from multiple repositories. + This should be an absolute path to the .git directory of the other + repository. Default value: none. + repo.branch-sort:: Flag which, when set to "age", enables date ordering in the branch ref list, and when set to "name" enables ordering by branch name. Default -- 2.35.1.46.g38062e73e0 From vegard.nossum at oracle.com Mon Oct 17 12:12:27 2022 From: vegard.nossum at oracle.com (Vegard Nossum) Date: Mon, 17 Oct 2022 14:12:27 +0200 Subject: git notes for the Linux kernel In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: <4f2f0588-f46b-44d3-6aa1-a5c0e7cd5619@oracle.com> On 10/17/22 13:50, Vegard Nossum wrote: > cgit patches will follow in replies to this email -- the two prerequisite > git.git patches are available at the git mailing list link above and > should apply cleanly to v2.38.0. Looks like the list rejected 2 of the patches for containing HTML, when those were actually plaintext emails with patches tweaking cgit's HTML generation code -- maybe something to look into, as that doesn't seem too unusual for patches on this mailing list. Anyway, also attaching a tarball with all the patches here, assuming that makes it through the filter! Vegard -------------- next part -------------- A non-text attachment was scrubbed... Name: notes.tar.bz2 Type: application/x-bzip Size: 4989 bytes Desc: not available URL: From john at keeping.me.uk Tue Oct 18 20:20:03 2022 From: john at keeping.me.uk (John Keeping) Date: Tue, 18 Oct 2022 21:20:03 +0100 Subject: git notes for the Linux kernel In-Reply-To: <20221017115010.21977-1-vegard.nossum@oracle.com> References: <20221017115010.21977-1-vegard.nossum@oracle.com> Message-ID: On Mon, Oct 17, 2022 at 01:50:04PM +0200, Vegard Nossum wrote: > I've improved the support for git notes in cgit, including the ability > to load notes from a separate repository than the one you are viewing. > > My use case is using a separate repository of git notes for the Linux > kernel to annotate commits with extra cross-referencing information such > as e.g.: > > - lore links to patch submissions matching the patch, > - references to subsequent fixes (if the current commit is buggy) > - mitre links to CVEs > - references to backports in stable/LTS This sounds useful, but... > My hope is that these notes can eventually be displayed on > git.kernel.org -- at least, we've found the notes invaluable and a huge > time saver in different types of kernel work. (I'm still in the process > of working out how to release these notes and/or the scripts generating > them, but that's a different topic.) > > I tried to submit the git.git patches upstream, but they were rejected > by the maintainer for not being general enough: > https://lore.kernel.org/git/20220802075401.2393-1-vegard.nossum at oracle.com/ ... this likely blocks inclusion in CGit as I don't think there's any desire to maintain a fork of git.git Parts of this series look like they make sense regardless of the separate repo option - patch 2 looks unrelated and the repo.notes_ref config option is potentially useful to keep the CGit config separate from gitconfig (although it should be "repo.notes-ref" for consistency with other config keys). Are you interested in splitting those parts out? Regards, John