17ec681f3SmrgSource Code Repository 27ec681f3Smrg====================== 37ec681f3Smrg 47ec681f3SmrgMesa uses `Git <https://git-scm.com>`__ as its source code management 57ec681f3Smrgsystem. 67ec681f3Smrg 77ec681f3SmrgThe upstream Git repository is hosted on 87ec681f3Smrg`freedesktop.org <https://www.freedesktop.org>`__. 97ec681f3Smrg 107ec681f3SmrgYou may access the repository either as an :ref:`anonymous 117ec681f3Smrguser <anonymous>` (read-only) or as a :ref:`developer <developer>` 127ec681f3Smrg(read/write). 137ec681f3Smrg 147ec681f3SmrgYou may also `browse the main Mesa Git 157ec681f3Smrgrepository <https://gitlab.freedesktop.org/mesa/mesa>`__ and the `Mesa 167ec681f3Smrgdemos and tests Git 177ec681f3Smrgrepository <https://gitlab.freedesktop.org/mesa/demos>`__. 187ec681f3Smrg 197ec681f3Smrg.. _anonymous: 207ec681f3Smrg 217ec681f3SmrgAnonymous Git Access 227ec681f3Smrg-------------------- 237ec681f3Smrg 247ec681f3SmrgTo get the Mesa sources anonymously (read-only): 257ec681f3Smrg 267ec681f3Smrg#. Install the Git software on your computer if needed. 277ec681f3Smrg#. Get an initial, local copy of the repository with: 287ec681f3Smrg 297ec681f3Smrg .. code-block:: console 307ec681f3Smrg 317ec681f3Smrg git clone https://gitlab.freedesktop.org/mesa/mesa.git 327ec681f3Smrg 337ec681f3Smrg#. Later, you can update your tree from the upstream repository with: 347ec681f3Smrg 357ec681f3Smrg .. code-block:: console 367ec681f3Smrg 377ec681f3Smrg git pull origin 387ec681f3Smrg 397ec681f3Smrg#. If you also want the Mesa demos/tests repository: 407ec681f3Smrg 417ec681f3Smrg .. code-block:: console 427ec681f3Smrg 437ec681f3Smrg git clone https://gitlab.freedesktop.org/mesa/demos.git 447ec681f3Smrg 457ec681f3Smrg.. _developer: 467ec681f3Smrg 477ec681f3SmrgDeveloper Git Access 487ec681f3Smrg-------------------- 497ec681f3Smrg 507ec681f3SmrgIf you wish to become a Mesa developer with GitLab merge privilege, 517ec681f3Smrgplease follow this procedure: 527ec681f3Smrg 537ec681f3Smrg#. Subscribe to the 547ec681f3Smrg `mesa-dev <https://lists.freedesktop.org/mailman/listinfo/mesa-dev>`__ 557ec681f3Smrg mailing list. 567ec681f3Smrg#. Start contributing to the project by :doc:`submitting 577ec681f3Smrg patches <submittingpatches>`. Specifically, 587ec681f3Smrg 597ec681f3Smrg - Use `GitLab <https://gitlab.freedesktop.org/>`__ to create your 607ec681f3Smrg merge requests. 617ec681f3Smrg - Wait for someone to review the code and give you a ``Reviewed-by`` 627ec681f3Smrg statement. 637ec681f3Smrg - You'll have to rely on another Mesa developer to push your initial 647ec681f3Smrg patches after they've been reviewed. 657ec681f3Smrg 667ec681f3Smrg#. After you've demonstrated the ability to write good code and have had 677ec681f3Smrg a dozen or so patches accepted, a maintainer may use their discretion 687ec681f3Smrg to give you access to merge your own code. 697ec681f3Smrg 707ec681f3SmrgPushing code to your GitLab account via HTTPS 717ec681f3Smrg--------------------------------------------- 727ec681f3Smrg 737ec681f3SmrgUseful for people behind strict proxies 747ec681f3Smrg 757ec681f3SmrgYou can use `personal access 767ec681f3Smrgtokens <https://gitlab.freedesktop.org/profile/personal_access_tokens>`__ 777ec681f3Smrgto push over HTTPS if ssh does not suit your needs. In this case, create 787ec681f3Smrga token, and put it in the URL as shown here: 797ec681f3Smrg 807ec681f3Smrg.. code-block:: console 817ec681f3Smrg 827ec681f3Smrg git remote set-url --push origin https://USER:TOKEN@gitlab.freedesktop.org/your~user~name/mesa.git 837ec681f3Smrg 847ec681f3SmrgWindows Users 857ec681f3Smrg------------- 867ec681f3Smrg 877ec681f3SmrgIf you're `using Git on 887ec681f3SmrgWindows <https://git.wiki.kernel.org/index.php/WindowsInstall>`__ you'll 897ec681f3Smrgwant to enable automatic CR/LF conversion in your local copy of the 907ec681f3Smrgrepository: 917ec681f3Smrg 927ec681f3Smrg.. code-block:: console 937ec681f3Smrg 947ec681f3Smrg git config --global core.autocrlf true 957ec681f3Smrg 967ec681f3SmrgThis will cause Git to convert all text files to CR+LF on checkout, and 977ec681f3Smrgto LF on commit. 987ec681f3Smrg 997ec681f3SmrgUnix users don't need to set this option. 1007ec681f3Smrg 1017ec681f3SmrgDevelopment Branches 1027ec681f3Smrg-------------------- 1037ec681f3Smrg 1047ec681f3SmrgAt any given time, there may be several active branches in Mesa's 1057ec681f3Smrgrepository. Generally, ``main`` contains the latest development 1067ec681f3Smrg(unstable) code while a branch has the latest stable code. 1077ec681f3Smrg 1087ec681f3SmrgThe command ``git branch`` will list all available branches. 1097ec681f3Smrg 1107ec681f3SmrgQuestions about branch status/activity should be posted to the mesa-dev 1117ec681f3Smrgmailing list. 1127ec681f3Smrg 1137ec681f3SmrgDeveloper Git Tips 1147ec681f3Smrg------------------ 1157ec681f3Smrg 1167ec681f3Smrg#. Setting up to edit the main branch 1177ec681f3Smrg 1187ec681f3Smrg If you try to do a pull by just saying\ ``git pull`` and Git 1197ec681f3Smrg complains that you have not specified a branch, try: 1207ec681f3Smrg 1217ec681f3Smrg .. code-block:: console 1227ec681f3Smrg 1237ec681f3Smrg git config branch.main.remote origin 1247ec681f3Smrg git config branch.main.merge main 1257ec681f3Smrg 1267ec681f3Smrg Otherwise, you have to say\ ``git pull origin main`` each time you 1277ec681f3Smrg do a pull. 1287ec681f3Smrg 1297ec681f3Smrg#. Small changes to main 1307ec681f3Smrg 1317ec681f3Smrg If you are an experienced Git user working on substantial 1327ec681f3Smrg modifications, you are probably working on a separate branch and 1337ec681f3Smrg would rebase your branch prior to merging with main. But for small 1347ec681f3Smrg changes to the main branch itself, you also need to use the rebase 1357ec681f3Smrg feature in order to avoid an unnecessary and distracting branch in 1367ec681f3Smrg main. 1377ec681f3Smrg 1387ec681f3Smrg If it has been awhile since you've done the initial clone, try 1397ec681f3Smrg 1407ec681f3Smrg .. code-block:: console 1417ec681f3Smrg 1427ec681f3Smrg git pull 1437ec681f3Smrg 1447ec681f3Smrg to get the latest files before you start working. 1457ec681f3Smrg 1467ec681f3Smrg Make your changes and use 1477ec681f3Smrg 1487ec681f3Smrg .. code-block:: console 1497ec681f3Smrg 1507ec681f3Smrg git add <files to commit> 1517ec681f3Smrg git commit 1527ec681f3Smrg 1537ec681f3Smrg to get your changes ready to push back into the freedesktop.org 1547ec681f3Smrg repository. 1557ec681f3Smrg 1567ec681f3Smrg It is possible (and likely) that someone has changed main since you 1577ec681f3Smrg did your last pull. Even if your changes do not conflict with their 1587ec681f3Smrg changes, Git will make a fast-forward merge branch, branching from 1597ec681f3Smrg the point in time where you did your last pull and merging it to a 1607ec681f3Smrg point after the other changes. 1617ec681f3Smrg 1627ec681f3Smrg To avoid this, 1637ec681f3Smrg 1647ec681f3Smrg .. code-block:: console 1657ec681f3Smrg 1667ec681f3Smrg git pull --rebase 1677ec681f3Smrg git push 1687ec681f3Smrg 1697ec681f3Smrg If you are familiar with CVS or similar system, this is similar to 1707ec681f3Smrg doing a ``cvs update`` in order to update your source tree to the 1717ec681f3Smrg current repository state, instead of the time you did the last 1727ec681f3Smrg update. (CVS doesn't work like Git in this respect, but this is 1737ec681f3Smrg easiest way to explain it.) 1747ec681f3Smrg 1757ec681f3Smrg In any case, your repository now looks like you made your changes 1767ec681f3Smrg after all the other changes. 1777ec681f3Smrg 1787ec681f3Smrg If the rebase resulted in conflicts or changes that could affect the 1797ec681f3Smrg proper operation of your changes, you'll need to investigate those 1807ec681f3Smrg before doing the push. 1817ec681f3Smrg 1827ec681f3Smrg If you want the rebase action to be the default action, then 1837ec681f3Smrg 1847ec681f3Smrg .. code-block:: console 1857ec681f3Smrg 1867ec681f3Smrg git config branch.main.rebase true 1877ec681f3Smrg git config --global branch.autosetuprebase=always 1887ec681f3Smrg 1897ec681f3Smrg See `Understanding Git 1907ec681f3Smrg Conceptually <https://www.eecs.harvard.edu/~cduan/technical/git/>`__ 1917ec681f3Smrg for a fairly clear explanation about all of this. 192