GitHub repo vs cgit

Is it recommended to use GH repo instead of cgit?
No.

First of all, cgit is not a repo but a (very lightweight) web frontend for browsing a repo. The actual repos are hosted on git.freebsd.org (whithout the c). Github works differently, offering the repo and a web frontend on the same routes.

It's not recommended to use Github, because it's just a read-only mirror of the official repo hosted by FreeBSD. As such, it can even "lag behind" a bit, while cgit will always show you the exact current state of the official repo.

Reasons to use Github might include
  • (for the project) visibility, Github is one of the "canonical" git hosters and people tend to look for source code there
  • a need for one of the "advanced" features of Github's UI (like flexible search, symbol identification, easy "git blame" browsing, etc) that cgit can't offer in the same way
  • contributing by Github's "pull request" workflow. I personally don't like that extra (and incompatible) contribution channel and really prefer a PR on bugzilla with a patch (git format-patch) attached, or for really complex changes, a review on phabricator. But I've seen src accepts and handles Github pull requests ... not sure what's the current practice for ports.
 
No.

First of all, cgit is not a repo but a (very lightweight) web frontend for browsing a repo. The actual repos are hosted on git.freebsd.org (whithout the c). Github works differently, offering the repo and a web frontend on the same routes.

It's not recommended to use Github, because it's just a read-only mirror of the official repo hosted by FreeBSD. As such, it can even "lag behind" a bit, while cgit will always show you the exact current state of the official repo.

git.freebsd.org can lag a bit too. This is because the actual repo that commits are made to, and which I won't list here because nobody can clone or pull from it, will push out commits to the git repo mirrors and to github.

git.freebsd.org is geolocated. Different parts of the world will hit a different git mirror. cgit.freebsd.org may also be geolocated.

Reasons to use Github might include
  • (for the project) visibility, Github is one of the "canonical" git hosters and people tend to look for source code there
  • a need for one of the "advanced" features of Github's UI (like flexible search, symbol identification, easy "git blame" browsing, etc) that cgit can't offer in the same way
  • contributing by Github's "pull request" workflow. I personally don't like that extra (and incompatible) contribution channel and really prefer a PR on bugzilla with a patch (git format-patch) attached, or for really complex changes, a review on phabricator. But I've seen src accepts and handles Github pull requests ... not sure what's the current practice for ports.
The other reason to use github is most people understand pull requests. Using phabricator for reviews is foreign to most people who are not committers.

I agree that from a committer POV github pull requests are a PITA but committing non-committer code from phabricator is IMO worse.

People submitting commits via bugs.freebsd.org has the advantage of simply downloading the commit and git am, but the review process via bugs.freebsd.org is horrible.

For functionality github reviews and phabricatior reviews are easier than reviewing a bugs.freebsd.org attachment. A bugzilla attachment can be committed using a git am command. But committing someone else's phabricator review requires I write the commt log entry, or maybe copy and paste it from the phabricator description, assumng the submittor has done a decent job of that. And, I don't like writing commit log entries for other people.

IMO github pull requests encompass the review and comit log. But the review comments and how we got there are on github, Microsoft's infrastructure. Should that go away we lose that history. In other words, there is no perfect solution, though my choice, functionally, would be either github or phabricator.
 
git.freebsd.org can lag a bit too. This is because the actual repo that commits are made to, and which I won't list here because nobody can clone or pull from it, will push out commits to the git repo mirrors and to github.
Interesting. I never experienced any issues with my "asymmetric" setup (pulling from git.freebsd.org) though, so, seems to be "quick enough" to sync.

People submitting commits via bugs.freebsd.org has the advantage of simply downloading the commit and git am, but the review process via bugs.freebsd.org is horrible.
For the majority of submissions we get on ports, this isn't much of an issue because they are small enough to do the review on bugzilla, but sure, for more complex reviews, that's not suitable.

For functionality github reviews and phabricatior reviews are easier than reviewing a bugs.freebsd.org attachment. A bugzilla attachment can be committed using a git am command. But committing someone else's phabricator review requires I write the commt log entry, or maybe copy and paste it from the phabricator description, assumng the submittor has done a decent job of that. And, I don't like writing commit log entries for other people.
You might want to give git-arc a try, meanwhile conveniently available from devel/freebsd-git-devtools:
Code:
  $ git arc patch D12345

  Apply the patch in review D12345 to the currently checked-out tree, and
  commit it using the review's title, summary and author.

I agree phabricator isn't perfect regarding this specific workflow, this little utility for integration with git helps (not only with that) IMHO.

IMO github pull requests encompass the review and comit log. But the review comments and how we got there are on github, Microsoft's infrastructure. Should that go away we lose that history. In other words, there is no perfect solution, though my choice, functionally, would be either github or phabricator.
Well, I'm not generally against the pull requests like github invented them. The major issue is, as you state yourself, relying on 3rd party infrastructure for "important" bits of information. What really annoys me is having different channels. Maybe, if we really think we want this "pull request" style workflow, hosting something like e.g. forgejo ourselves might help end this zoo of contribution channels.
 
Interesting. I never experienced any issues with my "asymmetric" setup (pulling from git.freebsd.org) though, so, seems to be "quick enough" to sync.


For the majority of submissions we get on ports, this isn't much of an issue because they are small enough to do the review on bugzilla, but sure, for more complex reviews, that's not suitable.

Usually it is. You can see the remote URLs using git remote -v. The push URL is the authoritative repo while the pull is the mirror. For src it's,

slippy$ git remote -v
freebsd https://git.freebsd.org/src.git (fetch)
freebsd git@gitrepo.freebsd.org:src.git (push)
github https://github.com/freebsd/freebsd-src (fetch)
github https://github.com/freebsd/freebsd-src (push)
slippy$

For ports it's,

slippy$ git remote -v
github https://github.com/freebsd/freebsd-ports (fetch)
github https://github.com/freebsd/freebsd-ports (push)
origin https://git.freebsd.org/ports.git (fetch)
origin git@gitrepo.freebsd.org:ports.git (push)
slippy$

You might want to give git-arc a try, meanwhile conveniently available from devel/freebsd-git-devtools:
Code:
  $ git arc patch D12345

  Apply the patch in review D12345 to the currently checked-out tree, and
  commit it using the review's title, summary and author.

I should give this a spin.

I agree phabricator isn't perfect regarding this specific workflow, this little utility for integration with git helps (not only with that) IMHO.


Well, I'm not generally against the pull requests like github invented them. The major issue is, as you state yourself, relying on 3rd party infrastructure for "important" bits of information. What really annoys me is having different channels. Maybe, if we really think we want this "pull request" style workflow, hosting something like e.g. forgejo ourselves might help end this zoo of contribution channels.
forgejo is lightweight enough. Github does do some ci build testing for us. jenkins handles most CI testing. Github handles Linux, MacOS and other weird tests. I learned that the hard way after a commit to Makefile.inc. make universe on the universe machines built ok. It was pointed out to me that Linux cross builds were failing because Linux didn't support architecture word length like FreeBSD does; the CPP variable was left undefined and pre-build failed. I think for the time being we need all repos.

I do use forgejo locally for firewall rules and my ansible. It's perfect with a small footprint. Maybe FreeBSD would need something more full featured like gitlab to replace github.
 
forgejo is lightweight enough. Github does do some ci build testing for us. jenkins handles most CI testing. Github handles Linux, MacOS and other weird tests. I learned that the hard way after a commit to Makefile.inc. make universe on the universe machines built ok. It was pointed out to me that Linux cross builds were failing because Linux didn't support architecture word length like FreeBSD does; the CPP variable was left undefined and pre-build failed. I think for the time being we need all repos.
Don't get me wrong, I have no concerns about having a mirror on Github at all, and also I don't think having some "exotic" CI builds there is a problem either. My concern is only about 1) having the history of reviews there instead of own infrastructure (that can be important to understand a specific change later) and 2) having a multitude of contribution channels.

I do use forgejo locally for firewall rules and my ansible. It's perfect with a small footprint. Maybe FreeBSD would need something more full featured like gitlab to replace github.
My gut feeling is that gitlab is a somewhat heavy "monster" and something light-weight might be the better option, but that's a detail discussion in the end. I'm personally happy with the current tooling as well, maybe a helper like git-arc needs a bit more advertising. Please just consolidate tooling and processes in some way ;).
 
But the review comments and how we got there are on github, Microsoft's infrastructure.
This is why I don't want to have github account, causing I cannot contribute the way. Only Bugzilla, Phablicator, mailing lists, mastodon, matrix and here forums are the possible way for me.

And via phablicator, what I can is to test, comment and (if required) review the codes there, as I never succeeded to upload/register patches (diffs) there.
 
This is why I don't want to have github account, causing I cannot contribute the way. Only Bugzilla, Phablicator, mailing lists, mastodon, matrix and here forums are the possible way for me.
Having a Github account won't do you any harm. But it really makes sense to think through what you want to trust to a 3rd party platform. For my private projects, I'm perfectly fine with Github, reviews are rare and small for these and I make sure to put everything relevant in the commit messages, which are part of the (redundant by nature) git repository data. Of course I still accept contributions by email in git format-patch, so having a Github account isn't strictly required.

And via phablicator, what I can is to test, comment and (if required) review the codes there, as I never succeeded to upload/register patches (diffs) there.
Well, you must setup arc correctly: https://wiki.freebsd.org/Phabricator#Setup

And then, I can really recommend git-arc, see above. Here's an introduction: https://freebsdfoundation.org/wp-content/uploads/2021/11/FreeBSD-Code-Review-with-git-arc.pdf

In the end, you have to get along with "plain" arc as well, unfortunately. While git-arc has great support for creating and managing a stack of reviews where every review corresponds to a single commit, it unfortunately doesn't support multiple commits in a single review, which is sometimes more appropriate.
 
The reason I asked is that by tinkering inside /usr/src, files tend to become corrupt and git pull doesn't solve these problem(s). So, I delete src and clone again, but the average speed I get when cloning from FreeBSD's git is 1.84MiB/s vs 48.4MiB/s from GH. There are no factors from my side that I can think of to be affecting these speeds since I use the same hardware, software and internet at the same time of day.
 
The reason I asked is that by tinkering inside /usr/src, files tend to become corrupt and git pull doesn't solve these problem(s).
Regarding that, you should probably learn how git works and use that to your advantage. If you want to fiddle with code locally, create a local branch (e.g. git checkout -b local) and then commit your changes there. Then you can rebase that branch onto whatever you track from upstream, e.g. assuming a release branch:
Code:
git checkout local
git fetch origin releng/14.1:releng/14.1
git rebase releng/14.1
... and resolve possible conflicts one commit at a time.

the average speed I get when cloning from FreeBSD's git is 1.84MiB/s vs 48.4MiB/s from GH.
That's unfortunate. There's no reason not to pull from Github instead, just be aware it's a read-only mirror and syncing it might lag (very slightly), so it's possible you'll be a few commits behing what you'd get from git.freebsd.org, although not too likely.
 
No.

First of all, cgit is not a repo but a (very lightweight) web frontend for browsing a repo. The actual repos are hosted on git.freebsd.org (whithout the c). Github works differently, offering the repo and a web frontend on the same routes.

It's not recommended to use Github, because it's just a read-only mirror of the official repo hosted by FreeBSD. As such, it can even "lag behind" a bit, while cgit will always show you the exact current state of the official repo.

Reasons to use Github might include
  • (for the project) visibility, Github is one of the "canonical" git hosters and people tend to look for source code there
  • a need for one of the "advanced" features of Github's UI (like flexible search, symbol identification, easy "git blame" browsing, etc) that cgit can't offer in the same way
  • contributing by Github's "pull request" workflow. I personally don't like that extra (and incompatible) contribution channel and really prefer a PR on bugzilla with a patch (git format-patch) attached, or for really complex changes, a review on phabricator. But I've seen src accepts and handles Github pull requests ... not sure what's the current practice for ports.
It's perfectly fine to use one of the mirrors (Github, Codeberg, GitLab (https://docs.freebsd.org/en/books/handbook/mirrors/#external-mirrors)), the delay is roughly normally a few minutes so it's not you're missing out on something and for a "consumer" it's more than fine. Actually I would encourge people to use one of these as they're as noted by others (SirDice for example) very often noticably faster than the geodns'ed git.freebsd.org hosts.

The tool you're using (if using git) can also affect performance quite a bit, https://projects.pyret.net/files/public/freebsd/git-tools.htm
gitup is missing because I couldn't get to work without throwing errors upon connecting.
 
t's perfectly fine to use one of the mirrors (Github, Codeberg, GitLab (https://docs.freebsd.org/en/books/handbook/mirrors/#external-mirrors)), the delay is roughly normally a few minutes so it's not you're missing out on something and for a "consumer" it's more than fine.
See also my latest answer directly above. I think the initial question kind of missed an important qualification: recommended for what?

For the purpose of active development and "local hacking" e.g. on main, a delay (important to understand here: it's expected to be very small, but there can't be a guarantee, it's effectively an "eventual consistency" model) can cause irritation and I'd recommend to avoid that as far as possible.

If all you want is to keep your local installation updated from source, even more so when following a release branch, it doesn't matter at all and using a mirror to pull makes a lot of sense if that performs better. In the unlikely event a sync job is ever broken, you'll notice trivially on a release branch. In the similarly unlikely event that FreeBSD would ever be forced to abandon the mirror you're using, you should be prepared to edit your "remotes" to switch to a different one (a simple and reliable thing to do).

Disclaimer: Both above are my personal opinion.
 
Back
Top