List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: RFC: snapshot tarball information in refs/notes/snapshots
Date: Fri, 30 Mar 2018 17:38:29 +0100	[thread overview]
Message-ID: <20180330163829.GC2287@john.keeping.me.uk> (raw)
In-Reply-To: <20180330153838.GA26612@gmail.com>

On Fri, Mar 30, 2018 at 11:38:38AM -0400, Konstantin Ryabitsev wrote:
> On Fri, Mar 30, 2018 at 12:53:57PM +0100, John Keeping wrote:
> > Unfortunately there is one big gotcha I encountered doing this, which is
> > that we don't have the repository set up when we are scanning this
> > configuration, because this is done when building the repository list
> > not just for loading repository-specific pages.  Since one of the
> > configuration options is the repository description, I think this is
> > unavoidable.
> 
> One other way I'd thought about doing this is via a post-update hook
> that would read the configuration from an object in the repo into a file
> cgit could read, but I didn't want to write out into .git/config.
> 
> That might be one way of achieving compromise -- support per-repository
> configuration that users themselves can push, but make it up to the
> server administrator to set up hooks so that the config gets written out
> into .git/cgitrc (or repo.git/cgitrc) for cgit to consume. In my mind,
> it was a note attached to the initial commit of the master branch, but
> it can be any object that post-update can access and write out.
> 
> This way cgit doesn't need to rely on git to read this data, as it's a
> regular config file inside the git dir. The post-update hook can also do
> any sanitization of config parameters it deems necessary.
> 
> Does that make sense?

Yes, repo.git/cgitrc is already read unconditionally when using
scan-path to find repositories (under the same conditions as
.git/config).

In a few months, I think it will be possible to pull configuration
directly from objects in the Git repository, but if you want a solution
today then a post-update hook seems like the best way to do it.  As you
say, this also has the advantage that the adminstrator can apply
additional policy to the variables set in the repository.

I don't think notes are the right solution because they tie information
to a particular commit and it's difficult to consistently pick a commit
from which to pull the configuration: anything other than the tip of a
branch will incur the cost of walking to find an annotated commit but
keeping the note at the tip of the branch is difficult and likely to
result in the configuration being lost.

A special ref for configuration is reasonably easy to maintain and if
it's a branch then you can get history attached config file changes for
free.


  reply	other threads:[~2018-03-30 16:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 21:23 mricon
2018-03-21 12:38 ` Jason
2018-03-21 14:03   ` mricon
2018-03-30 11:53     ` john
2018-03-30 15:38       ` konstantin
2018-03-30 16:38         ` john [this message]
2018-03-30 17:44           ` konstantin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180330163829.GC2287@john.keeping.me.uk \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).