GitLab

From FlightGear wiki
Jump to navigation Jump to search

GitLab is an open source hosting infrastructure provider. Since January 2025, it hosts several Git version control repositories of FlightGear that were previously hosted on SourceForge.

Development

Merge request

First, open the repository you want to change and fork the project using the Fork button.

Clone your forked repository to your computer, add the original upstream repository

git remote add upstream https://gitlab.com/flightgear/flightgear.git

Then to update your repo with changes from original repo (example with next branch) :

git pull --rebase upstream next

Go to the branch you want to change, then from it, create a new branch for your MR.

git checkout -b my_new_feature

Create your commits on this branch, and push to your origin repository.

Once done, on Gitlab, on your repo, it will propose you to create a Merge Request.

pre-commit

When opening a merge request in GitLab, a pre-commit hook is run. Assuming origin is the name of the Git remote for the official repository you'd like to contribute to, you can test your changes locally with:

git diff --name-only origin/next | xargs -r pre-commit run --files

This changes/fixes your working directory so you can commit, check or reset the changes.

Note  The pre-commit run command will immediately show the changes if you pass it the --show-diff-on-failure option.

Sample output of the pre-commit run command:

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing src/AIModel/AIConstants.hxx
Fixing src/ATC/ATCController.hxx

trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing src/Airports/groundnetwork.cxx
Fixing src/AIModel/AIAircraft.cxx
Fixing src/AIModel/AIConstants.hxx
Fixing src/ATC/ATCController.cxx
Fixing src/ATC/trafficcontrol.cxx
Fixing src/ATC/ATCController.hxx
Fixing src/AIModel/AIFlightPlanCreate.cxx
Fixing src/ATC/GroundController.cxx

codespell................................................................Failed
- hook id: codespell
- exit code: 65

src/AIModel/AIFlightPlan.hxx:53: nam ==> name
src/AIModel/AIFlightPlan.hxx:53: nam ==> name
src/ATC/ApproachController.cxx:91: exsists ==> exists
src/Airports/groundnetwork.cxx:183: backard ==> backward
src/ATC/ATCController.hxx:43: acknowlegde ==> acknowledge
src/ATC/trafficcontrol.cxx:76: existant ==> existent
src/ATC/trafficcontrol.cxx:105: paramater ==> parameter
src/ATC/trafficcontrol.cxx:213: paramater ==> parameter
src/ATC/GroundController.cxx:158: acknowlegde ==> acknowledge
src/ATC/GroundController.cxx:537: maintanance ==> maintenance

yamlfmt..............................................(no files to check)Skipped
clang-format.............................................................Failed
- hook id: clang-format
- files were modified by this hook
reuse lint-file..........................................................Failed
- hook id: reuse-lint-file
- exit code: 1

src/ATC/ApproachController.cxx: no license identifier
src/ATC/trafficcontrol.hxx: no license identifier
src/ATC/TowerController.cxx: no license identifier
src/ATC/trafficcontrol.hxx: no copyright notice
src/ATC/trafficcontrol.cxx: no license identifier
test_suite/unit_tests/AI/TestSuite.cxx: no license identifier
src/ATC/GroundController.cxx: no license identifier
src/ATC/atc_mgr.cxx: no license identifier
src/ATC/atc_mgr.cxx: no copyright notice

References