neuropoly / gitea

https://gitea.io fork with https://git-annex.branchable.com support
https://gitea.io
MIT License
3 stars 2 forks source link

Add tests for push-to-create #46

Open matrss opened 10 months ago

matrss commented 10 months ago

This adds tests for creating a repository using the push-to-create feature. The tests are the equivalent of doing

git remote add origin <url>
git annex sync --content

in a local git-annex repository.

The steps it does are:

  1. create a local git-annex repository
  2. add a non-existing repository as a remote
  3. sync using git annex sync --content

It then checks that:

This is done both for a repository in a user's namespace and for a repository in an organization's namespace.

These tests fail at the moment because the default branch does not match. The created repository has a default branch of synced/master while it should be master, which is the current HEAD when pushing. I'll have to investigate how to fix that bug.

Fixes #14.

kousu commented 10 months ago

You're on such a roll! omg. I still need to merge the original PR 😵 This is great, really awesome. Please keep them coming.

kousu commented 10 months ago

By the way I noticed you customised your templates in your fork directly; you could take a look at https://docs.gitea.com/administration/customizing-gitea. We use gitea embedded extract during install to get files out then like, sed to patch them with our logos.

matrss commented 10 months ago

This is great, really awesome. Please keep them coming.

Slowly chipping away at some of the low-hanging fruits :smiley: forking is something I would like to look at too at some point, although that seems to be more complicated.

By the way I noticed you customised your templates in your fork directly; you could take a look at https://docs.gitea.com/administration/customizing-gitea. We use gitea embedded extract during install to get files out then like, sed to patch them with our logos.

Thanks for the pointer, I'll take a look at that. I spend quite a bit of time yesterday bringing those templates up-to-date and your approach would indeed be easier. The changes aren't that big anyway. I remember I had some issues getting the templates out of gitea embedded though...

These tests fail at the moment because the default branch does not match. The created repository has a default branch of synced/master while it should be master, which is the current HEAD when pushing. I'll have to investigate how to fix that bug.

The setting.Repository.DefaultBranch is set to master in the tests. But I think git annex sync --content pushes synced/master first and because master does not immediately exist it will then default to the first branch it sees instead. I am not sure how that would or should be fixed... Maybe recommending to git push && git annex sync --content would be better, and if someone runs into this they can still change the default branch afterwards. I am not sure yet.