From: Omar Polo Subject: Re: make gotd reject sha2 repos earlier To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Wed, 07 Aug 2024 16:11:50 +0200 On 2024/08/07 16:08:02 +0200, Stefan Sperling wrote: > On Wed, Aug 07, 2024 at 03:01:03PM +0200, Omar Polo wrote: > > > + /* > > > + * SHA2 repositories cannot be used with gotd until Git protocol v2 > > > + * support is added. Reject them at startup for now. > > > + */ > > > + TAILQ_FOREACH(repo, &gotd.repos, entry) { > > > + struct got_repository *r; > > > + > > > + error = got_repo_open(&r, repo->path, NULL, NULL); > > > + if (error) > > > + fatalx("%s: %s", repo->path, error->msg); > > > + > > > + if (got_repo_get_object_format(r) != GOT_HASH_SHA1) { > > > + error = got_error_msg(GOT_ERR_NOT_IMPL, > > > + "sha256 object IDs unsupported in network " > > > + "protocol"); > > > + fatalx("%s: %s", repo->path, error->msg); > > > + } > > > + > > > + got_repo_close(r); > > > + } > > > > didn't we also allowed repositories to be listed but not yet created? > > or maybe i'm remembering wrong. > > In theory, yes, the intention was to do this. Thanks for reminding me. > However, it turns out I already broke this functionality back in commit > 4b3827cd43394b89d2af822dcd1d9a9179c1ee10 > "make gitwrapper ignore 'permission denied' for repository paths" ah, ops, sorry for forgetting this while reviewing that diff. maybe we need to add a test :P > Since then parse.y runs yyerror() when a repository does not exist, > causing gotd to exit on startup. Which can be fixed separately. sure > Here is a new version of the proposed diff which ignores ENOENT. ok op@, thank you!