Adding a --sha256 option to create

19 views
Skip to first unread message

klea

unread,
Apr 28, 2026, 6:38:20 AMApr 28
to gito...@googlegroups.com
Hello Gitolite mailing list,

I was wondering if an option to the create wild repos executable could be
added to make a sha256 repo.

Thanks in advance.

Cheers
--
Klea
kl...@iwnp.org

Sitaram Chamarty

unread,
Apr 28, 2026, 6:44:45 AMApr 28
to klea, gito...@googlegroups.com
As of a few months ago, git itself is not yet ready for this, as far as
I can tell.
See https://github.com/sitaramc/gitolite/blob/sha256-support/README-SHA256.mkd

Sitaram Chamarty

unread,
May 1, 2026, 11:37:28 AMMay 1
to klea, gito...@googlegroups.com
clone the repo and look for 2 branches:

-  demo-sha256-method-1
-  demo-sha256-method-2

I guess I forgot to say, in that document, how to find that code

On 01/05/26 20:48, klea wrote:
> On Tue, 28 Apr 2026 16:14:39 +0530 Sitaram Chamarty <sita...@gmail.com> wrote:
>> As of a few months ago, git itself is not yet ready for this, as far as
>> I can tell.
>> See https://github.com/sitaramc/gitolite/blob/sha256-support/README-SHA256.mkd
> Based on reading your document, it seems that if you initially make a
> repo sha256 it does work, so I was wondering if it'd be possible to add a
> flag, like --sha256 to `create` such that it sets
> $ENV{GIT_DEFAULT_HASH} = "sha256";
> before running the internal create new repo function.
>
> Cheers

Sitaram Chamarty

unread,
May 1, 2026, 12:18:13 PMMay 1
to klea, gito...@googlegroups.com
On Fri, May 01, 2026 at 03:46:17PM +0000, klea wrote:
> On 01/05/26 20:48, klea wrote:
> > On Tue, 28 Apr 2026 16:14:39 +0530 Sitaram Chamarty <sita...@gmail.com> wrote:
> >> As of a few months ago, git itself is not yet ready for this, as far as
> >> I can tell.
> >> See https://github.com/sitaramc/gitolite/blob/sha256-support/README-SHA256.mkd
> > Based on reading your document, it seems that if you initially make a
> > repo sha256 it does work, so I was wondering if it'd be possible to add a
> > flag, like --sha256 to `create` such that it sets
> > $ENV{GIT_DEFAULT_HASH} = "sha256";
> > before running the internal create new repo function.
> >
> > Cheers
>
> I think I was proposing another method, for wild repos, without requiring
> every new repo be sha256.

- just grab src/triggers/sha256 from that branch and put it in
your LOCAL_CODE. It's just 4 lines of shell.

- add this to your gitolite.rc, just before the "ENABLE => ["
line

POST_CREATE =>
[
'sha256'
],

- now add `option sha256 = 1` to any repo you want, wild or
normal.

Sitaram Chamarty

unread,
May 3, 2026, 9:51:11 PMMay 3
to klea, gito...@googlegroups.com
On Sun, May 03, 2026 at 05:28:44PM +0000, klea wrote:
> Fails for me when I want to have u/OWNER/* be wild, and want that some of
> those be sha256.

First, I don't think `u/OWNER/*` is even a valid pattern; it
should be CREATOR and the `*` should be `.*`. So I'm not even
sure what you're doing, unless that was an typo in the email
only.

Second, help me understand why you would want only some to be
sha256 and not all.

Third, is there a sub-pattern that defines the sha256 repos?
You could always do this:

repo u/CREATOR/.*
...
...
... all the other rules that apply to these repos ...
...
...


repo u/CREATOR/my-special-repos/.*
option sha256 = 1
# just the one option, nothing esle

If there's no pattern that defines sha256 and it's completely ad
hoc then there's no way to do this within gitolite.conf.

You can always write your own "create" command and use that
instead. Just use the existing command, and add these lines at
the end:

diff --git i/src/commands/create w/src/commands/create
index 8565e68..cb5e589 100755
--- i/src/commands/create
+++ w/src/commands/create
@@ -27,3 +27,8 @@ _die "repo already exists or you are not authorised to create it" if $ret =~ /DE

new_wild_repo( $repo, $ENV{GL_USER}, 'create' );
gl_log( 'create', $repo, $ENV{GL_USER}, 'create' );
+
+chdir "$ENV{GL_REPO_BASE}/$repo.git" or die "huh?";
+system("git config core.repositoryformatversion 1");
+system("git config extensions.objectformat sha256");
+

Don't forget to enable the command in the rc file by
uncommenting the line within the ENABLE list.

Sitaram Chamarty

unread,
May 3, 2026, 9:59:54 PMMay 3
to klea, gito...@googlegroups.com
On Mon, May 04, 2026 at 07:21:04AM +0530, Sitaram Chamarty wrote:

> You can always write your own "create" command and use that
> instead. Just use the existing command, and add these lines at
> the end:

I'm sure you know this, but auto-created repos (i.e., repos that
get auto-vivified when, e.g., you `git clone me:u/me/foo`) will
still be governed by whatever you have in gitolite.conf.

klea

unread,
May 5, 2026, 6:44:20 AM (14 days ago) May 5
to Sitaram Chamarty, gito...@googlegroups.com
On Tue, 28 Apr 2026 16:14:39 +0530 Sitaram Chamarty <sita...@gmail.com> wrote:
> As of a few months ago, git itself is not yet ready for this, as far as
> I can tell.
> See https://github.com/sitaramc/gitolite/blob/sha256-support/README-SHA256.mkd

Based on reading your document, it seems that if you initially make a
repo sha256 it does work, so I was wondering if it'd be possible to add a
flag, like --sha256 to `create` such that it sets
$ENV{GIT_DEFAULT_HASH} = "sha256";
before running the internal create new repo function.

Cheers
--
Klea
kl...@iwnp.org

klea

unread,
May 5, 2026, 6:44:20 AM (14 days ago) May 5
to Sitaram Chamarty, gito...@googlegroups.com

klea

unread,
May 5, 2026, 6:44:20 AM (14 days ago) May 5
to Sitaram Chamarty, gito...@googlegroups.com
On 01/05/26 20:48, klea wrote:
> On Tue, 28 Apr 2026 16:14:39 +0530 Sitaram Chamarty <sita...@gmail.com> wrote:
>> As of a few months ago, git itself is not yet ready for this, as far as
>> I can tell.
>> See https://github.com/sitaramc/gitolite/blob/sha256-support/README-SHA256.mkd
> Based on reading your document, it seems that if you initially make a
> repo sha256 it does work, so I was wondering if it'd be possible to add a
> flag, like --sha256 to `create` such that it sets
> $ENV{GIT_DEFAULT_HASH} = "sha256";
> before running the internal create new repo function.
>
> Cheers

I think I was proposing another method, for wild repos, without requiring
every new repo be sha256.


Cheers
--
Klea
kl...@iwnp.org
Reply all
Reply to author
Forward
0 new messages