1848b8605Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2848b8605Smrg<html lang="en">
3848b8605Smrg<head>
4848b8605Smrg  <meta http-equiv="content-type" content="text/html; charset=utf-8">
5848b8605Smrg  <title>Code Repository</title>
6848b8605Smrg  <link rel="stylesheet" type="text/css" href="mesa.css">
7848b8605Smrg</head>
8848b8605Smrg<body>
9848b8605Smrg
10848b8605Smrg<div class="header">
11848b8605Smrg  <h1>The Mesa 3D Graphics Library</h1>
12848b8605Smrg</div>
13848b8605Smrg
14848b8605Smrg<iframe src="contents.html"></iframe>
15848b8605Smrg<div class="content">
16848b8605Smrg
17848b8605Smrg<h1>Code Repository</h1>
18848b8605Smrg
19848b8605Smrg<p>
20b8e80941SmrgMesa uses <a href="https://git-scm.com">git</a>
21848b8605Smrgas its source code management system.
22848b8605Smrg</p>
23848b8605Smrg
24848b8605Smrg<p>
25848b8605SmrgThe master git repository is hosted on
26b8e80941Smrg<a href="https://www.freedesktop.org">freedesktop.org</a>.
27848b8605Smrg</p>
28848b8605Smrg
29848b8605Smrg<p>
30848b8605SmrgYou may access the repository either as an
31848b8605Smrg<a href="#anonymous">anonymous user</a> (read-only) or as a
32848b8605Smrg<a href="#developer">developer</a>
33848b8605Smrg(read/write).
34848b8605Smrg</p>
35848b8605Smrg
36848b8605Smrg<p>
37848b8605SmrgYou may also 
38b8e80941Smrg<a href="https://gitlab.freedesktop.org/mesa/mesa"
39848b8605Smrg>browse the main Mesa git repository</a> and the
40b8e80941Smrg<a href="https://gitlab.freedesktop.org/mesa/demos"
41848b8605Smrg>Mesa demos and tests git repository</a>.
42848b8605Smrg</p>
43848b8605Smrg
44848b8605Smrg
45848b8605Smrg<h2 id="anonymous">Anonymous git Access</h2>
46848b8605Smrg
47848b8605Smrg<p>
48848b8605SmrgTo get the Mesa sources anonymously (read-only):
49848b8605Smrg</p>
50848b8605Smrg
51848b8605Smrg<ol>
52848b8605Smrg<li>Install the git software on your computer if needed.<br><br>
53848b8605Smrg<li>Get an initial, local copy of the repository with:
54848b8605Smrg    <pre>
55b8e80941Smrg    git clone https://gitlab.freedesktop.org/mesa/mesa.git
56848b8605Smrg    </pre>
57848b8605Smrg<li>Later, you can update your tree from the master repository with:
58848b8605Smrg    <pre>
59848b8605Smrg    git pull origin
60848b8605Smrg    </pre>
61848b8605Smrg<li>If you also want the Mesa demos/tests repository:
62848b8605Smrg    <pre>
63b8e80941Smrg    git clone https://gitlab.freedesktop.org/mesa/demos.git
64848b8605Smrg    </pre>
65848b8605Smrg</ol>
66848b8605Smrg
67848b8605Smrg
68848b8605Smrg<h2 id="developer">Developer git Access</h2>
69848b8605Smrg
70848b8605Smrg<p>
71b8e80941SmrgIf you wish to become a Mesa developer with git-write privilege, please
72b8e80941Smrgfollow this procedure:
73848b8605Smrg</p>
74b8e80941Smrg<ol>
75b8e80941Smrg<li>Subscribe to the
76b8e80941Smrg<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">mesa-dev</a>
77b8e80941Smrgmailing list.
78b8e80941Smrg<li>Start contributing to the project by
79b8e80941Smrg<a href="submittingpatches.html" target="_parent">submitting patches</a> to
80b8e80941Smrgthe mesa-dev list.  Specifically,
81b8e80941Smrg<ul>
82b8e80941Smrg<li>Use <code>git send-mail</code> to post your patches to mesa-dev.
83b8e80941Smrg<li>Wait for someone to review the code and give you a <code>Reviewed-by</code>
84b8e80941Smrgstatement.
85b8e80941Smrg<li>You'll have to rely on another Mesa developer to push your initial patches
86b8e80941Smrgafter they've been reviewed.
87b8e80941Smrg</ul>
88b8e80941Smrg<li>After you've demonstrated the ability to write good code and have had
89b8e80941Smrga dozen or so patches accepted you can apply for an account.
90b8e80941Smrg<li>Occasionally, but rarely, someone may be given a git account sooner, but
91b8e80941Smrgonly if they're being supervised by another Mesa developer at the same
92b8e80941Smrgorganization and planning to work in a limited area of the code or on a
93b8e80941Smrgseparate branch.
94b8e80941Smrg<li>To apply for an account, follow
95b8e80941Smrg<a href="https://www.freedesktop.org/wiki/AccountRequests">these directions</a>.
96b8e80941SmrgIt's also appreciated if you briefly describe what you intend to do (work
97b8e80941Smrgon a particular driver, add a new extension, etc.) in the bugzilla record.
98b8e80941Smrg</ol>
99848b8605Smrg
100848b8605Smrg<p>
101b8e80941SmrgOnce your account is established, you can update your push url to use SSH:
102b8e80941Smrg<pre>
103b8e80941Smrggit remote set-url --push <em>origin</em> git@gitlab.freedesktop.org:mesa/mesa.git
104b8e80941Smrg</pre>
105848b8605Smrg
106b8e80941SmrgYou can also use <a href="https://gitlab.freedesktop.org/profile/personal_access_tokens">personal access tokens</a>
107b8e80941Smrgto push over HTTPS instead (useful for people behind strict proxies).
108b8e80941SmrgIn this case, create a token, and put it in the url as shown here:
109b8e80941Smrg<pre>
110b8e80941Smrggit remote set-url --push <em>origin</em> https://<em>USER</em>:<em>TOKEN</em>@gitlab.freedesktop.org/mesa/mesa.git
111b8e80941Smrg</pre>
112848b8605Smrg
113848b8605Smrg
114848b8605Smrg<h2>Windows Users</h2>
115848b8605Smrg
116848b8605Smrg<p>
117b8e80941SmrgIf you're <a href="https://git.wiki.kernel.org/index.php/WindowsInstall">
118848b8605Smrgusing git on Windows</a> you'll want to enable automatic CR/LF conversion in
119848b8605Smrgyour local copy of the repository:
120848b8605Smrg</p>
121848b8605Smrg<pre>
122848b8605Smrg   git config --global core.autocrlf true
123848b8605Smrg</pre>
124848b8605Smrg
125848b8605Smrg<p>
126848b8605SmrgThis will cause git to convert all text files to CR+LF on checkout,
127848b8605Smrgand to LF on commit.
128848b8605Smrg</p>
129848b8605Smrg<p>
130848b8605SmrgUnix users don't need to set this option.
131848b8605Smrg</p>
132848b8605Smrg<br>
133848b8605Smrg
134848b8605Smrg
135848b8605Smrg<h2>Development Branches</h2>
136848b8605Smrg
137848b8605Smrg<p>
138848b8605SmrgAt any given time, there may be several active branches in Mesa's
139848b8605Smrgrepository.
140b8e80941SmrgGenerally, <tt>master</tt> contains the latest development (unstable)
141848b8605Smrgcode while a branch has the latest stable code.
142848b8605Smrg</p>
143848b8605Smrg
144848b8605Smrg<p>
145b8e80941SmrgThe command <code>git branch</code> will list all available branches.
146848b8605Smrg</p>
147848b8605Smrg
148848b8605Smrg<p>
149848b8605SmrgQuestions about branch status/activity should be posted to the
150b8e80941Smrgmesa-dev mailing list.
151848b8605Smrg</p>
152848b8605Smrg
153848b8605Smrg<h2>Developer Git Tips</h2>
154848b8605Smrg
155848b8605Smrg<ol>
156848b8605Smrg<li>Setting up to edit the master branch
157848b8605Smrg<p>
158848b8605SmrgIf you try to do a pull by just saying<code> git pull </code>
159848b8605Smrgand git complains that you have not specified a
160848b8605Smrgbranch, try:
161848b8605Smrg<pre>
162848b8605Smrg    git config branch.master.remote origin
163848b8605Smrg    git config branch.master.merge master
164848b8605Smrg</pre>
165848b8605Smrg<p>
166848b8605SmrgOtherwise, you have to say<code> git pull origin master </code>
167848b8605Smrgeach time you do a pull.
168848b8605Smrg</p>
169848b8605Smrg<li>Small changes to master
170848b8605Smrg<p>
171848b8605SmrgIf you are an experienced git user working on substantial modifications,
172848b8605Smrgyou are probably
173848b8605Smrgworking on a separate branch and would rebase your branch prior to
174848b8605Smrgmerging with master.
175848b8605SmrgBut for small changes to the master branch itself,
176848b8605Smrgyou also need to use the rebase feature in order to avoid an
177848b8605Smrgunnecessary and distracting branch in master.
178848b8605Smrg</p>
179848b8605Smrg<p>
180848b8605SmrgIf it has been awhile since you've done the initial clone, try
181848b8605Smrg<pre>
182848b8605Smrg    git pull
183848b8605Smrg</pre>
184848b8605Smrg<p>
185848b8605Smrgto get the latest files before you start working.
186848b8605Smrg</p>
187848b8605Smrg<p>
188848b8605SmrgMake your changes and use
189848b8605Smrg<pre>
190848b8605Smrg    git add &lt;files to commit&gt;
191848b8605Smrg    git commit
192848b8605Smrg</pre>
193848b8605Smrg<p>
194848b8605Smrgto get your changes ready to push back into the fd.o repository.
195848b8605Smrg</p>
196848b8605Smrg<p>
197848b8605SmrgIt is possible (and likely) that someone has changed master since
198848b8605Smrgyou did your last pull.  Even if your changes do not conflict with
199848b8605Smrgtheir changes, git will make a fast-forward 
200848b8605Smrgmerge branch, branching from the point in time
201848b8605Smrgwhere you did your last pull and merging it to a point after the other changes.
202848b8605Smrg</p>
203848b8605Smrg<p>
204848b8605SmrgTo avoid this, 
205848b8605Smrg<pre>
206848b8605Smrg    git pull --rebase
207848b8605Smrg    git push
208848b8605Smrg</pre>
209848b8605Smrg<p>
210848b8605SmrgIf you are familiar with CVS or similar system, this is similar to doing a
211848b8605Smrg<code> cvs update </code> in order to update your source tree to
212848b8605Smrgthe current repository state, instead of the time you did the last update.
213848b8605Smrg(CVS doesn't work like git in this respect, but this is easiest way
214848b8605Smrgto explain it.)
215848b8605Smrg<br>
216848b8605SmrgIn any case, your repository now looks like you made your changes after
217848b8605Smrgall the other changes.
218848b8605Smrg</p>
219848b8605Smrg<p>
220848b8605SmrgIf the rebase resulted in conflicts or changes that could affect
221848b8605Smrgthe proper operation of your changes, you'll need to investigate
222848b8605Smrgthose before doing the push.
223848b8605Smrg</p>
224848b8605Smrg<p>
225848b8605SmrgIf you want the rebase action to be the default action, then
226848b8605Smrg<pre>
227848b8605Smrg    git config branch.master.rebase true
228848b8605Smrg    git config --global branch.autosetuprebase=always
229848b8605Smrg</pre>
230848b8605Smrg<p>
231b8e80941SmrgSee <a href="https://www.eecs.harvard.edu/~cduan/technical/git/">Understanding Git Conceptually</a> for a fairly clear explanation about all of this.
232848b8605Smrg</p>
233848b8605Smrg</ol>
234848b8605Smrg
235848b8605Smrg</div>
236848b8605Smrg</body>
237848b8605Smrg</html>
238