~vcs-imports/gawk/master

731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1
\input texinfo   @c -*-texinfo-*-
2
@c vim: filetype=texinfo expandtab tabstop=4 shiftwidth=4
3
@c %**start of header (This is for running Texinfo on a region.)
4
@setfilename gawkworkflow.info
5
@settitle GNU Awk Development Workflow
6
@c %**end of header (This is for running Texinfo on a region.)
7
8
@dircategory Text creation and manipulation
9
@direntry
10
* Gawk Work Flow: (gawkworkflow).                 Participating in @command{gawk} development.
11
@end direntry
12
@dircategory Individual utilities
13
@direntry
14
* Gawk Work Flow: (gawkworkflow)Overview.         Participating in @command{gawk} development.
15
@end direntry
16
17
@c With early 2014 texinfo.tex, restore PDF links and colors
18
@tex
19
\gdef\linkcolor{0.5 0.09 0.12} % Dark Red
20
\gdef\urlcolor{0.5 0.09 0.12} % Also
21
\global\urefurlonlylinktrue
22
@end tex
23
24
@set xref-automatic-section-title
25
26
@c The following information should be updated here only!
27
@c This sets the edition of the document, the version of gawk it
28
@c applies to and all the info about who's publishing this edition
29
30
@c These apply across the board.
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
31
@set UPDATE-MONTH March, 2023
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
32
33
@set TITLE Participating in @command{gawk} Development
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
34
@set EDITION 0.75
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
35
36
@iftex
37
@set DOCUMENT booklet
38
@set CHAPTER chapter
39
@set APPENDIX appendix
40
@set SECTION section
41
@set SUBSECTION subsection
42
@end iftex
43
@ifinfo
44
@set DOCUMENT Info file
45
@set CHAPTER major node
46
@set APPENDIX major node
47
@set SECTION minor node
48
@set SUBSECTION node
49
@end ifinfo
50
@ifhtml
51
@set DOCUMENT Web page
52
@set CHAPTER chapter
53
@set APPENDIX appendix
54
@set SECTION section
55
@set SUBSECTION subsection
56
@end ifhtml
57
@ifdocbook
58
@set DOCUMENT booklet
59
@set CHAPTER chapter
60
@set APPENDIX appendix
61
@set SECTION section
62
@set SUBSECTION subsection
63
@end ifdocbook
64
@ifxml
65
@set DOCUMENT booklet
66
@set CHAPTER chapter
67
@set APPENDIX appendix
68
@set SECTION section
69
@set SUBSECTION subsection
70
@end ifxml
71
@ifplaintext
72
@set DOCUMENT booklet
73
@set CHAPTER chapter
74
@set APPENDIX appendix
75
@set SECTION section
76
@set SUBSECTION subsection
77
@end ifplaintext
78
79
80
@ifnottex
81
@ifnotdocbook
82
@macro ii{text}
83
@i{\text\}
84
@end macro
85
@end ifnotdocbook
86
@end ifnottex
87
88
@ifdocbook
89
@macro ii{text}
90
@inlineraw{docbook,<lineannotation>\text\</lineannotation>}
91
@end macro
92
@end ifdocbook
93
94
@c For HTML, spell out email addresses, to avoid problems with
95
@c address harvesters for spammers.
96
@ifhtml
97
@macro EMAIL{real,spelled}
98
``\spelled\''
99
@end macro
100
@end ifhtml
101
@ifnothtml
102
@macro EMAIL{real,spelled}
103
@email{\real\}
104
@end macro
105
@end ifnothtml
106
107
108
@c merge the function and variable indexes into the concept index
109
@ifinfo
110
@synindex fn cp
111
@synindex vr cp
112
@end ifinfo
113
@iftex
114
@syncodeindex fn cp
115
@syncodeindex vr cp
116
@end iftex
117
@ifxml
118
@syncodeindex fn cp
119
@syncodeindex vr cp
120
@end ifxml
121
@ifdocbook
122
@synindex fn cp
123
@synindex vr cp
124
@end ifdocbook
125
126
@c If "finalout" is commented out, the printed output will show
127
@c black boxes that mark lines that are too long.  Thus, it is
128
@c unwise to comment it out when running a master in case there are
129
@c overfulls which are deemed okay.
130
131
@iftex
132
@finalout
133
@end iftex
134
135
@copying
136
@docbook
137
<para>Published by:</para>
138
139
<literallayout class="normal">Free Software Foundation
140
51 Franklin Street, Fifth Floor
141
Boston, MA  02110-1301 USA
142
Phone: +1-617-542-5942
143
Fax: +1-617-542-2652
144
Email: <email>gnu@@gnu.org</email>
145
URL: <ulink url="http://www.gnu.org">http://www.gnu.org/</ulink></literallayout>
146
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
147
<literallayout class="normal">Copyright &copy; 2017, 2018, 2019, 2020, 2022, 2023
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
148
Free Software Foundation, Inc.
149
All Rights Reserved.</literallayout>
150
@end docbook
151
152
@ifnotdocbook
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
153
Copyright @copyright{} 2017, 2018, 2019, 2020, 2022, 2023
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
154
Free Software Foundation, Inc.
155
@end ifnotdocbook
156
@sp 2
157
158
This is Edition @value{EDITION} of @cite{@value{TITLE}}.
159
160
Permission is granted to copy, distribute and/or modify this document
161
under the terms of the GNU Free Documentation License, Version 1.3 or
162
any later version published by the Free Software Foundation; with the
163
Invariant Sections being ``GNU General Public License'', with the
164
Front-Cover Texts being ``A GNU Manual'', and with the Back-Cover Texts
165
as in (a) below.
166
A copy of the license is included in the section entitled
167
``GNU Free Documentation License''.
168
169
@enumerate a
170
@item
171
The FSF's Back-Cover Text is: ``You have the freedom to
172
copy and modify this GNU manual.''
173
@end enumerate
174
@end copying
175
176
@c Comment out the "smallbook" for technical review.  Saves
177
@c considerable paper.  Remember to turn it back on *before*
178
@c starting the page-breaking work.
179
180
@c 4/2002: Karl Berry recommends commenting out this and the
181
@c `@setchapternewpage odd', and letting users use `texi2dvi -t'
182
@c if they want to waste paper.
183
@c @smallbook
184
185
186
@c Uncomment this for the release.  Leaving it off saves paper
187
@c during editing and review.
188
@c @setchapternewpage odd
189
190
@c @shorttitlepage @value{TITLE}
191
@titlepage
192
@title @value{TITLE}
193
@subtitle Edition @value{EDITION}
194
@subtitle @value{UPDATE-MONTH}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
195
@author Arnold D.@: Robbins
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
196
197
@ifnotdocbook
198
@c Include the Distribution inside the titlepage environment so
199
@c that headings are turned off.  Headings on and off do not work.
200
201
@page
202
@vskip 0pt plus 1filll
203
Published by:
204
@sp 1
205
206
Free Software Foundation @*
207
51 Franklin Street, Fifth Floor @*
208
Boston, MA  02110-1301 USA @*
209
Phone: +1-617-542-5942 @*
210
Fax: +1-617-542-2652 @*
211
Email: @email{gnu@@gnu.org} @*
212
URL: @uref{http://www.gnu.org/} @*
213
214
@c ISBN x-xxxxxx-xx-x @*
215
@sp 2
216
@insertcopying
217
@end ifnotdocbook
218
@end titlepage
219
220
@iftex
221
@headings off
222
@evenheading @thispage@ @ @ @strong{@value{TITLE}} @| @|
223
@oddheading  @| @| @strong{@thischapter}@ @ @ @thispage
224
@end iftex
225
226
@ifnottex
227
@ifnotxml
228
@ifnotdocbook
229
@node Top
230
@top General Introduction
231
@c Preface node should come right after the Top
232
@c node, in `unnumbered' sections, then the first chapter.
233
234
This file describes how to participate in software development for
235
@uref{http://www.gnu.org/software/gawk, GNU Awk (@command{gawk})}.
236
237
@insertcopying
238
239
@end ifnotdocbook
240
@end ifnotxml
241
@end ifnottex
242
243
@menu
244
* Preface::                           Some introductory remarks.
245
* Contributing::                      How to contribute to @command{gawk}
246
                                      development.
247
* Using Git::                         Getting started with Git.
248
* Configuring git::                   Configuring Git.
731.3.76 by Arnold D. Robbins
Fix spelling errors in gawkworkflow.texi and spellchecking in doc/Makefile.am.
249
* Development without commit access:: How to work without commit access.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
250
* Development with commit access::    How to work with commit access.
251
* General practices::                 How things should usually be done.
252
* Repo Maintenance::                  Tips for keeping your repo clean.
253
* Development Stuff::                 Things you need to know to be a
254
                                      @command{gawk} developer.
255
* Cheat Sheet::                       Git command summary.
256
* Resources::                         Some further resources.
257
* TODO::                              Stuff still to do.
258
* Index::                             The index.
259
260
@detailmenu
261
* This Manual::                     How to use this manual.
262
* Conventions::                     Typographical Conventions.
263
* Acknowledgments::                 Acknowledgments.
264
* Reviewers::                       A note to reviewers.
265
* Push Pull::                       The push/pull software development model.
266
* Repo Copies::                     What it means to have a copy of a repo.
267
* Local Branches::                  How to best use local branches.
268
* Branches are state::              Branches represent development state.
269
* Repo State::                      The different branch types in the repo.
270
* Local State::                     Managing local branches.
271
* Remotes::                         What a ``remote'' is.
272
* Cloning::                         Cloning the repo the first time.
273
* Switching Branches::              Moving from one branch to another.
274
* Starting A New Branch::           Starting a new branch for development.
275
* Undoing a change::                Throwing away changes.
276
* Updating::                        Keeping in sync with the upstream repo.
277
* Rebasing::                        Rebasing A Local Branch.
278
* Merge Conflicts::                 Dealing With Merge Conflicts.
279
* Submitting Changes::              How to submit your changes.
280
* Removing Branches::               Getting rid of unneeded branches.
281
* Points to remember::              Things you need to keep in mind.
282
* Initial setup::                   Getting started with commit access.
283
* ssh clone::                       Cloning using an @samp{ssh://} URL.
284
* Developing patches::              Developing patches.
285
* Developing new features::         Developing new features.
286
* Developing fixes::                Developing fixes.
287
* Coding style::                    Where to read up on the coding style.
288
* Doing paperwork::                 Legal stuff in order to contribute.
289
* Tools::                           Tools to have on your system for
290
                                    development.
291
* GNU Tools::                       The GNU Autotools.
292
* Compilers::                       A discussion of compilers that can be
293
                                    used.
294
* Debugging::                       Compiling for debugging.
295
@end detailmenu
296
@end menu
297
298
@c @summarycontents
299
@contents
300
301
@node Preface
302
@unnumbered Preface
303
@c I saw a comment somewhere that the preface should describe the book itself,
304
@c and the introduction should describe what the book covers.
305
306
This @value{DOCUMENT} describes how to participate in development
307
of GNU Awk (@command{gawk}).  GNU Awk is a Free Software project
308
belonging to the Free Software Foundation's GNU project.
309
1721 by Arnold D. Robbins
Start on workflow doc improvements.
310
@menu
311
* Intended Audience::           Who should read this manual.
312
* This Manual::                 How to use this manual.
313
* Conventions::                 Typographical Conventions.
314
* Acknowledgments::             Acknowledgments.
315
* Reviewers::                   A note to reviewers.
316
@end menu
317
318
@node Intended Audience
319
@unnumberedsec Intended Audience
320
321
This @value{DOCUMENT} is aimed at software developers who wish
322
to participate in @command{gawk} development.
323
324
You should be comfortable working with traditional Unix-style
325
command-line tools, and with the C language and standard library facilities.
326
327
You should also have some prior experience using distributed
328
source code control systems, such as the Concurrent Versions
329
System (CVS) or Subversion (SVN).  Experience with a more modern
330
system such as Mercurial or Git will be even more helpful.
331
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
332
@cindex Git Project
333
The @value{DOCUMENT} focuses on participation in the project (that is,
334
how to work most effectively if you wish to contribute to it) and
335
also describes how to make use of the @uref{http://git-scm.org, Git}
336
distributed source code management system for @command{gawk} development.
337
338
@node This Manual
339
@unnumberedsec Using This Book
340
341
This @value{DOCUMENT} has the following chapters and appendices:
342
343
@itemize @bullet
344
345
@item
346
@ref{Contributing} describes how to start contributing to
347
the @command{gawk} project.
348
349
@item
350
@ref{Using Git} introduces the Git distributed source code
351
management system.
352
353
@item
354
@ref{Configuring git} describes some initial set-up you need to do
355
before using Git seriously.
356
357
@item
358
@ref{Development without commit access} gets into the meat of the
359
development workflow, describing how to work if you don't have
360
commit access to the Savannah repository.
361
362
@item
363
@ref{Development with commit access} continues the discussion,
364
covering what's different when you can commit directly to the
365
Savannah repository.
366
367
@item
368
@ref{General practices} describes general development
369
practices used by the @command{gawk} development team.
370
371
@item
372
@ref{Repo Maintenance} presents several different things
1721 by Arnold D. Robbins
Start on workflow doc improvements.
373
you need to know about to keep your repository in good shape.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
374
375
@item
376
@ref{Development Stuff} describes some important points you
377
should be familiar with in order to participate in @command{gawk}
378
development and presents some tools that may make your work easier.
379
380
@item
381
@ref{Cheat Sheet} provides a short ``cheat sheet'' summarizing
382
all the Git commands referenced in this @value{DOCUMENT}.
383
384
@item
385
@ref{Resources} provides a few pointers to Internet
386
resources for learning more about Git.
387
388
@end itemize
389
390
@node Conventions
391
@unnumberedsec Typographical Conventions
392
393
@cindex Texinfo
394
This @value{DOCUMENT} is written in @uref{http://www.gnu.org/software/texinfo/, Texinfo},
395
the GNU documentation formatting language.
396
A single Texinfo source file is used to produce both the printed and online
397
versions of the documentation.
398
@ifnotinfo
399
Because of this, the typographical conventions
400
are slightly different than in other books you may have read.
401
@end ifnotinfo
402
@ifinfo
403
This @value{SECTION} briefly documents the typographical conventions used in Texinfo.
404
@end ifinfo
405
406
Examples you would type at the command line are preceded by the common
407
shell primary and secondary prompts, @samp{$} and @samp{>}.
408
Input that you type is shown @kbd{like this}.
409
Output from the command is preceded by the glyph ``@print{}''.
410
This typically represents the command's standard output.
411
Error messages and other output on the command's standard error are preceded
412
by the glyph ``@error{}''.  For example:
413
414
@example
415
$ @kbd{echo hi on stdout}
416
@print{} hi on stdout
417
$ @kbd{echo hello on stderr 1>&2}
418
@error{} hello on stderr
419
@end example
420
421
@ifnotinfo
422
In the text, almost anything related to programming, such as command
423
names, variable and function names, and string, numeric and regexp
1721 by Arnold D. Robbins
Start on workflow doc improvements.
424
constants appear in @code{this font}.  Code fragments appear in the same
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
425
font and quoted, @samp{like this}.  Things that are replaced by the
426
user or programmer appear in @var{this font}.  Options look like this:
427
@option{-f}.  File names are indicated like this: @file{/path/to/ourfile}.
428
Some things are emphasized @emph{like this}, and if a point needs to be
429
made strongly, it is done @strong{like this}.  The first occurrence of
430
a new term is usually its @dfn{definition} and appears in the same font
431
as the previous occurrence of ``definition'' in this sentence.
432
@end ifnotinfo
433
434
Characters that you type at the keyboard look @kbd{like this}.  In particular,
435
there are special characters called ``control characters.''  These are
436
characters that you type by holding down both the @kbd{CONTROL} key and
437
another key, at the same time.  For example, a @kbd{Ctrl-d} is typed
438
by first pressing and holding the @kbd{CONTROL} key, next
439
pressing the @kbd{d} key, and finally releasing both keys.
440
441
@quotation NOTE
442
Notes of interest look like this.
443
@end quotation
444
445
@quotation CAUTION
446
Cautionary or warning notes look like this.
447
@end quotation
448
449
@node Acknowledgments
450
@unnumberedsec Acknowledgments
451
452
@cindex Kahrs, J@"urgen
453
Thanks to J@"urgen Kahrs for his initial efforts to write a document like this.
454
Although his prose has not survived, his material was helpful in preparing
455
this @value{DOCUMENT}.
456
457
@cindex Bernat, Yehezkel
458
Thanks to Yehezkel Bernat for reviewing this document and
459
in general for his good intentions.
460
461
@strong{FIXME:} YOUR NAME HERE...
462
463
@node Reviewers
464
@unnumberedsec Notes to Reviewers
465
466
Please let me know if anything is missing, or unclear.
467
Real errors with respect Git commands and usage are
468
very important as well.
469
470
Spelling errors and typo fixes welcome, but not as important.
471
472
@node Contributing
473
@chapter How to Start Contributing
474
1721 by Arnold D. Robbins
Start on workflow doc improvements.
475
@command{gawk} development is distributed.  It's done using electronic
476
mail (@dfn{email}) and via branches in the Git repository (or @dfn{repo})
477
on @uref{http://savannah.gnu.org, Savannah}, the GNU
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
478
project's source code management site.
479
1721 by Arnold D. Robbins
Start on workflow doc improvements.
480
In this @value{CHAPTER} we use some Git terminology.  If you're not at
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
481
all familiar with Git, then skim this @value{CHAPTER} and come back
482
after reading the rest of the @value{DOCUMENT}.
483
1721 by Arnold D. Robbins
Start on workflow doc improvements.
484
@command{gawk} is similar to many other Free Software projects.  To begin
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
485
contributing, simply start!  Take a look at the @file{TODO} file in the
486
distribution, see if there is something of interest to you, and ask on
487
the @email{bug-gawk@@gnu.org} mailing list if anyone else is working
1721 by Arnold D. Robbins
Start on workflow doc improvements.
488
on it.  If not, then go for it!  (@xref{Development Stuff} for a discussion of some
489
of the technical things you'll need to do.  Here we describe the process
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
490
in general.)
491
492
Your contribution can be almost anything that is relevant for
493
@command{gawk}, such as code fixes, documentation fixes, and/or new
494
features.
495
496
@quotation NOTE
497
If possible, new features should be done using @command{gawk}'s extension
1721 by Arnold D. Robbins
Start on workflow doc improvements.
498
mechanism.  If you want to add a user-visible language change to the
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
499
@command{gawk} core, you're going to have to convince the maintainer
1721 by Arnold D. Robbins
Start on workflow doc improvements.
500
and the other developers that it's really worthwhile to do so.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
501
502
Changes that improve performance or portability, or that fix bugs,
503
or that enable more things in extensions,
504
will require less convincing, of course.
505
@end quotation
506
507
As you complete a task, submit patches for review to the
508
@email{bug-gawk@@gnu.org} mailing list, where you'll be given feedback
509
about your work.  Once your changes are acceptable, the maintainer will
510
commit them to the Git repository.
511
512
Over time, as the maintainer and development team gain confidence in your
513
ability to contribute, you may be asked to join the private @command{gawk}
514
developers' mailing list, and/or be granted commit access to the Git
515
repository on Savannah.  This has happened to more than one person who
516
just ``came out of the woodwork.''
517
518
Until that happens, or if you don't want to join the list, you should
519
continue to work with private branches and submission of patches to the
520
mailing list.
521
522
Once you have commit access, if you want to make a major change or add a
523
major feature, where the patch(es) would be very large, it has become the
524
practice to create a separate branch, based off of @code{master}, to host
1721 by Arnold D. Robbins
Start on workflow doc improvements.
525
the feature.  This way the maintainer can review it, and you can continue
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
526
to improve it, until it's ready for integration into @code{master}.
527
528
@cindex GitHub
529
@quotation NOTE
530
Because of the GNU project's requirements for signed paperwork for
531
contributions, the @command{gawk} project will @strong{not} work
532
with pull requests from @uref{http://github.com, GitHub} or any other
533
Git-based software hosting service.  You must submit patches to the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
534
mailing list, and be willing to sign paperwork for large patches
1724 by Arnold D. Robbins
Updates to gawkworkflow.texi.
535
(@pxref{Doing paperwork}).
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
536
@end quotation
537
1721 by Arnold D. Robbins
Start on workflow doc improvements.
538
The @email{bug-gawk@@gnu.org} mailing list is not private.  Anyone may
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
539
send mail to it, and anyone may subscribe to it.  To subscribe,
540
go to the list's @uref{https://lists.gnu.org/mailman/listinfo/bug-gawk,
541
web page} and follow the instructions there.  If you plan to be involved
542
long-term with @command{gawk} development, then you probably should
543
subscribe to the list.
544
545
@node Using Git
546
@chapter Using Git
547
1721 by Arnold D. Robbins
Start on workflow doc improvements.
548
This chapter provides an introduction to using Git.  Our point is
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
549
@emph{not} to rave about how wonderful Git is, nor to go into painful
550
detail about how it works.  Rather we want to give you enough background
551
to understand how to use Git effectively for bug fix and feature
552
development and to interact (``play nicely'') with the development team.
553
554
@menu
555
* Push Pull::                   The push/pull software development model.
556
* Repo Copies::                 What it means to have a copy of a repo.
557
* Local Branches::              How to best use local branches.
558
* Branches are state::          Branches represent development state.
559
@end menu
560
561
@node Push Pull
562
@section The ``Push/Pull'' Model of Software Development
563
564
Git is a powerful, distributed source code management system.  However,
565
the way it's used for @command{gawk} development purposely does not take
566
advantage of all its features.
567
568
Instead, the model is rather simple, and in many ways much like more
569
traditional distributed systems such as the @uref{http://www.nongnu.org/cvs,
570
Concurrent Versions System} (CVS) or
571
@uref{http://subversion.apache.org, Subversion} (SVN).
572
573
The central idea can be termed ``push/pull.'' You @emph{pull} updates down from
574
the central repository to your local copy, and if you have commit rights,
575
you @emph{push} your changes or updates up to the central repository.
576
1721 by Arnold D. Robbins
Start on workflow doc improvements.
577
Other developers work this way; pushing their changes up to the central
578
repository and pulling your changes down into theirs.
579
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
580
Where Git does stand out is in its management of multiple branches of
1721 by Arnold D. Robbins
Start on workflow doc improvements.
581
development.  Git makes it very easy to set up a separate branch for
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
582
use in fixing a bug or developing a feature.  You can then easily keep
583
that branch up to date with respect to the main development branch(es),
584
and eventually merge the changes from your branch into the main branch.
585
586
Almost always Git does these merges for you without problem.  When there
587
is a problem (a @dfn{merge conflict}), usually it is very easy for you
588
to @dfn{resolve} them and then complete the merge.  We talk about this
589
in more detail later (@pxref{Merge Conflicts}).
590
591
@node Repo Copies
592
@section How Git Stores Branches and Their Copies
593
594
So how does Git work?@footnote{The following description is greatly
595
simplified.}
596
1721 by Arnold D. Robbins
Start on workflow doc improvements.
597
A repository consists of a collection of @dfn{branches}.  Each branch
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
598
represents the history of a collection of files and directories (a file
1721 by Arnold D. Robbins
Start on workflow doc improvements.
599
@dfn{tree}).  Each combined set of changes to this collection (files and
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
600
directories added or deleted, and/or file contents changed) is termed
601
a @dfn{commit}.
602
603
When you first create a local copy of a remote repository (``clone
604
the repo''), Git copies all of the original repository's branches to
605
your local system.  The original remote repository is referred to as
606
being @dfn{upstream}, and your local repo is @dfn{downstream} from it.
607
Git distinguishes branches from the upstream repo by prefixing their
1721 by Arnold D. Robbins
Start on workflow doc improvements.
608
names with @samp{origin/}.  Let's draw some pictures.  @ref{savannah-repo}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
609
represents the state of the repo on Savannah:
610
611
@page
612
@float Figure,savannah-repo
613
@caption{The Savannah @command{gawk} Repository}
614
@smallexample
615
+======================+
616
|       Branches       |
617
+======================+
618
| master               |
619
+----------------------+
620
| gawk-4.1-stable      |
621
+----------------------+
622
| gawk-4.0-stable      |
623
+----------------------+
624
| feature/fix-comments |
625
+----------------------+
626
| ...                  |
627
+----------------------+
628
@end smallexample
629
@end float
630
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
631
@cindex @command{git} command @subentry @code{git branch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
632
After you clone the repo, on your local system you will have a single
633
branch named @code{master} that's visible when you use @samp{git branch}
634
to see your branches.
635
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
636
@cindex @command{git} command @subentry @code{git clone}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
637
@example
638
$ @kbd{git clone http://git.savannah.gnu.org/r/gawk.git}  @ii{Clone the repo}
639
$ @kbd{cd gawk}                                           @ii{Change to local copy}
640
$ @kbd{git branch}                                        @ii{See branch information}
641
@print{} * master
642
@end example
643
644
@noindent
645
The current branch is always indicated with a leading asterisk (@samp{*}).
646
647
Pictorially, the local repo looks like @ref{your-repo} (you can ignore
648
the @samp{T} column for the moment):
649
650
@float Figure,your-repo
651
@caption{Your Local @command{gawk} Repository}
652
@smallexample
653
+===+======================++=============================+
654
| T |    Local Branches    ||      Remote Branches        |
655
+===+======================++=============================+
656
| X | master               || origin/master               |
657
+---+----------------------++-----------------------------+
658
|   |                      || origin/gawk-4.1-stable      |
659
+---+----------------------++-----------------------------+
660
|   |                      || origin/gawk-4.0-stable      |
661
+---+----------------------++-----------------------------+
662
|   |                      || origin/feature/fix-comments |
663
+---+----------------------++-----------------------------+
664
|   |                      || ...                         |
665
+---+----------------------++-----------------------------+
666
@end smallexample
667
@end float
668
669
@noindent
670
@cindex @code{origin/} branches
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
671
@cindex branches @subentry @code{origin/}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
672
Note that what is simply @code{gawk-4.1-stable} in the upstream repo
673
is now referred to as @code{origin/gawk-4.1-stable}.  The @samp{origin/}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
674
branches are a snapshot of the state of the upstream repo.  This is
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
675
how Git allows you to see what changes you've made with respect to the
676
upstream repo, without having to actually communicate with the upstream
677
repo over the Internet.  (When files are identical, Git is smart enough
678
to not have two separate physical copies on your local disk.)
679
680
If you're working on a simple bug fix or change, you can do so directly
1721 by Arnold D. Robbins
Start on workflow doc improvements.
681
in your local @code{master} branch.  You can then commit your changes,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
682
and if you have access rights, push them upstream to the Savannah repo.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
683
(However, there is a process to follow.  Please read the rest of
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
684
this @value{DOCUMENT}.)
685
686
@node Local Branches
687
@section Local Branches
688
689
@cindex local branches
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
690
@cindex branches @subentry local
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
691
Let's talk about local branches in more detail.  (The terminology used
692
here is my own, not official Git jargon.) There are two kinds of local
693
branches:
694
695
@table @dfn
696
@item Tracking Branches
697
@cindex tracking branches
1814.1.105 by Arnold D. Robbins
Remove trailing whitespace from a bunch of files.
698
@cindex branches @subentry tracking
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
699
@cindex @command{git} command @subentry @code{git checkout}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
700
Tracking branches track branches from the upstream repository.  You first
701
create a tracking branch simply by checking out a branch from the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
702
upstream.  You use the branch name without the leading @samp{origin/}
703
prefix.  For example, @samp{git checkout gawk-4.1-stable}.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
704
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
705
@cindex @command{git} command @subentry @code{git push}
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
706
You can then work on this branch, making commits to it as you wish.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
707
Once things are ready to move upstream, you simply use @samp{git push},
708
and your changes will be pushed up to the main repo.@footnote{Assuming
709
you have permission to do so, of course.}
710
711
You should @strong{never} checkout a branch using the @samp{origin/}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
712
prefix.  Things will get very confused.  Always work on local tracking
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
713
branches.
714
715
@item Purely Local Branches
716
A @dfn{purely local branch} exists only on your system.  You may be developing
717
some large new feature, or fixing a very difficult bug, or have a change
718
for which paperwork has not yet been completed.
719
720
In such a case, you would keep your changes on a local branch, and
721
periodically synchronize it with @code{master} (or whichever upstream
722
branch you started from).
723
@end table
724
1721 by Arnold D. Robbins
Start on workflow doc improvements.
725
This may seem somewhat abstract so far.  We demonstrate with commands
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
726
and branches in @ref{Development without commit access},
727
later in this @value{DOCUMENT}.
728
729
Let's say you have checked out a copy of @code{gawk-4.1-stable} and
1721 by Arnold D. Robbins
Start on workflow doc improvements.
730
have created a purely local branch named @code{better-random}.  Then
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
731
our picture now looks like @ref{your-repo-2}, where the @samp{T} column
732
indicates a tracking branch.
733
734
@float Figure,your-repo-2
735
@caption{Your Local @command{gawk} Repository With a Purely Local Branch}
736
@smallexample
737
+===+======================++=============================+
738
| T |   Local Branches     ||      Remote Branches        |
739
+===+======================++=============================+
740
| X | master               || origin/master               |
741
+---+----------------------++-----------------------------+
742
| X | gawk-4.1-stable      || origin/gawk-4.1-stable      |
743
+---+----------------------++-----------------------------+
744
|   |                      || origin/gawk-4.0-stable      |
745
+---+----------------------++-----------------------------+
746
|   |                      || origin/feature/fix-comments |
747
+---+----------------------++-----------------------------+
748
|   |                      || ...                         |
749
+---+----------------------++-----------------------------+
750
|   | better-random        ||                             |
751
+---+----------------------++-----------------------------+
752
@end smallexample
753
@end float
754
755
@node Branches are state
756
@section Branches Represent Development State
757
1721 by Arnold D. Robbins
Start on workflow doc improvements.
758
Branches represent development state.  At any given time, when you
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
759
checkout a particular branch (or create a new one), you have a copy
760
of the @command{gawk} source tree that you should be able to build
761
and test.
762
763
The following @value{SECTION}s describe the different branches
764
in the @command{gawk} repository and what they are for, as well
765
as how to use your own branches.
766
767
@menu
768
* Repo State::                  The different branch types in the repo.
769
* Local State::                 Managing local branches.
770
* Remotes::                     What a ``remote'' is.
771
@end menu
772
773
@node Repo State
774
@subsection Branches in the Savannah Repository
775
776
There are several kinds of branches in the Savannah repository.
777
778
@table @dfn
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
779
@cindex branches @subentry dead
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
780
@cindex dead branches
781
@item Dead Branches
782
Branches with the prefix @samp{dead-branches/} (such as
783
@code{dead-branches/const}) hold code that was never merged into the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
784
main code base.  For example, a feature which was started, but later
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
785
deemed to be unwise to add.  These branches keep the code available,
786
but they are not updated.
787
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
788
@cindex branches @subentry stable
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
789
@cindex stable branches
790
@item Stable Branches
791
These branches are used for bug fixes to released versions
792
of @command{gawk}.  Sometimes new development (i.e., user-visible
793
changes) also occurs on these branches, although in a perfect world
794
they would be used only for bug fixes.
795
796
These branches have names like @code{gawk-4.1-stable},
797
@code{gawk-4.0-stable}, and so on.  Once a release has been made from
1721 by Arnold D. Robbins
Start on workflow doc improvements.
798
@code{master}, the previous stable branch is not updated.  For example,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
799
once @command{gawk} 4.1.0 was released, no more work was done on
800
@code{gawk-4.0-stable}.
801
802
@cindex branch, main
803
@cindex main branch
804
@cindex branch, @code{master}
805
@cindex @code{master} branch
806
@item The Main Branch
807
This is the @code{master} branch.  Here is where most new feature
808
development takes place, and releases of new major versions are based
809
off of this branch.
810
811
Feature branches are typically based off this branch as well, and when
812
the feature is deemed complete, merged back into it.
813
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
814
@cindex branches @subentry feature
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
815
@cindex feature branches
816
@item Feature Branches
817
Often, a proposed new feature or code improvement is quite involved.
818
It may take some time to perfect, or the @command{gawk} development team
819
may not be convinced that the feature should be kept.
820
821
For this purpose, the team uses branches prefixed with @samp{feature/}.
822
This prefix is used even for code that simply improves the internals
823
and does not make a user-visible change.
824
825
Having large changes on separate branches makes it easier for members
826
of the team to review the code, and also makes it easier to keep the
827
changes up-to-date with respect to @code{master}, since Git excels at
828
merging commits from one branch to another.
829
@end table
830
831
@node Local State
832
@subsection Branches in Your Local Repository
833
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
834
@cindex branches @subentry purely local
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
835
@cindex purely local branches
836
Purely local branches are where you do your own development.
837
You may use purely local branches because you don't have commit rights
1721 by Arnold D. Robbins
Start on workflow doc improvements.
838
to the Savannah repo.  You may also use them if you are doing some work
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
839
that isn't ready for sharing with the rest of the team, or cannot be
840
committed for some other reason.
841
842
For example, for around a nine-month period, the maintainer kept a
843
purely local branch for some contributed changes for which paperwork had
844
not yet been completed.
845
846
@node Remotes
847
@subsection A Closer Look at Branch Naming
848
849
@cindex @command{git branch} command, @option{-a} option
850
Earlier, we said that Git maintains copies of the branches
851
in the upstream repo, as well as manages your local branches.
852
You can see all these branches with @samp{git branch -a}:
853
854
@example
855
$ @kbd{git branch -a}
856
@print{}   gawk-4.1-stable
857
@print{} * master
858
@print{}   remotes/origin/HEAD -> origin/master
859
@print{}   remotes/origin/dead-branches/async-events
860
@print{}   @dots{}
861
@print{}   remotes/origin/feature/api-mpfr
862
@print{}   remotes/origin/feature/array-iface
863
@print{}   remotes/origin/feature/fix-comments
864
@print{}   @dots{}
865
@end example
866
867
You'll note that what we've referred to as @samp{origin/} branches
868
appear in the output with an additional prefix: @samp{remotes/}.
1113 by Arnold D. Robbins
Small doc updates.
869
Up to this point, we've treated Git as if it allowed only a single
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
870
upstream repository.  But in fact, you can configure it to use more
871
than one.  All the known upstream repositories are grouped under
872
the @samp{remotes/} prefix, with @code{remotes/origin} being the one
873
from which you initially cloned your local repository.
874
875
The ability to work with multiple upstream repositories is an
876
advanced one; @command{gawk} development does not make use of it.
877
The intent of this @value{SUBSECTION} is to explain the output
878
from @samp{git branch -a}, nothing more.
879
880
@node Configuring git
881
@chapter Configuring Global Settings For Git
882
883
@cindex configuration settings
884
@cindex settings, configuration
885
@cindex global configuration settings
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
886
@cindex configuration settings @subentry global
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
887
Before starting to use Git, you should configure it with some important
888
settings that won't change as you use Git.  You may configure options
889
both globally, and on a per-repository basis.  Here, we discuss only
890
global configuration settings.
891
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
892
@cindex @command{git} command @subentry @code{git config}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
893
You can configure Git using either @samp{git config}, or by editing
894
the relevant files with your favorite text editor.@footnote{You are
895
required to use either Vim or Emacs, other text editors are not
896
allowed.  Of course, reasonable developers wouldn't want to use
897
any other editor anyway.}
898
899
@cindex email address
900
The first things to set are your email address and your real name:
901
902
@cindex @code{user.name} configuration setting
903
@cindex @code{user.email} configuration setting
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
904
@cindex configuration setting @subentry @code{user.name}
905
@cindex configuration setting @subentry @code{user.email}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
906
@example
1721 by Arnold D. Robbins
Start on workflow doc improvements.
907
$ @kbd{git config --global user.name "J. P. Developer"}    @ii{Set full name}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
908
$ @kbd{git config --global user.email jpdev@@example.com}   @ii{Set email address}
909
@end example
910
911
Setting these two items are an absolute requirement.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
912
@strong{Note}: No aliases are allowed.  If you can't supply your
913
real name, you cannot contribute to the project.  Other options that
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
914
the @command{gawk} maintainer recommends that you use are:
915
916
@cindex @code{push.default} configuration setting
917
@cindex @code{pager.status} configuration setting
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
918
@cindex configuration setting @subentry @code{push.default}
919
@cindex configuration setting @subentry @code{pager.status}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
920
@example
1721 by Arnold D. Robbins
Start on workflow doc improvements.
921
$ @kbd{git config --global push.default simple}    @ii{Only push the current branch}
731.11.385 by Arnold D. Robbins
Minor doc fixes.
922
$ @kbd{git config --global pager.status true}      @ii{Use pager for output of} git status
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
923
@end example
924
925
@cindex @file{.gitconfig} file
926
The global settings are stored in the @file{.gitconfig} file in your
1721 by Arnold D. Robbins
Start on workflow doc improvements.
927
home directory.  The file looks like this:
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
928
929
@example
930
[user]
1721 by Arnold D. Robbins
Start on workflow doc improvements.
931
        name = J. P. Developer
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
932
        email = jpdev@@example.com
933
[push]
934
        default = simple
935
[pager]
936
        status = true
937
@end example
938
939
The @code{push.default=simple} setting ensures that older
940
versions of Git only push the current branch up to the Savannah
1721 by Arnold D. Robbins
Start on workflow doc improvements.
941
repo.  This is the safest way to operate, and is the default
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
942
in current Git versions.
943
944
There may be other settings in your configuration file as well.
945
Use @samp{git config} to see your settings:
946
947
@example
948
$ @kbd{git config --list}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
949
@print{} user.name=J. P. Developer
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
950
@print{} user.email=jpdev@@example.com
951
@print{} push.default=simple
952
@end example
953
954
Here are the @command{gawk} maintainer's settings:
955
956
@example
957
$ @kbd{git config --global --list}
958
@print{} user.name=Arnold D. Robbins
959
@print{} user.email=arnold@@@dots{}
960
@print{} credential.helper=cache --timeout=3600
961
@print{} push.default=simple
962
@print{} color.ui=false
963
@print{} core.autocrlf=input
964
@print{} pager.status=true
965
@print{} log.decorate=auto
966
@end example
967
968
Additional, per-project (``local'') settings are stored in
969
each repo's @file{.git/config} file.
970
971
@node Development without commit access
972
@chapter Development Without Commit Access
973
974
In this chapter we present step-by-step recipes for checking out
975
and working with a local
976
copy of the Savannah Git repo for @command{gawk}.
977
The presentation is for when you do not have commit access
978
to the Git repo, and so you cannot push your changes directly.
979
980
@menu
981
* Cloning::                     Cloning the repo the first time.
982
* Switching Branches::          Moving from one branch to another.
983
* Starting A New Branch::       Starting a new branch for development.
984
* Undoing a change::            Throwing away changes.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
985
* Saving Without Committing::   Moving changes aside.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
986
* Updating::                    Keeping in sync with the upstream repo.
987
* Submitting Changes::          How to submit your changes.
988
* Removing Branches::           Getting rid of unneeded branches.
989
* Points to remember::          Things you need to keep in mind.
990
@end menu
991
992
@node Cloning
993
@section Cloning The Repo
994
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
995
@cindex @command{git} command @subentry @code{git clone}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
996
Clone the Savannah repo using @samp{git clone}.  You should do so using
1735.1.1 by Arnold D. Robbins
Update copryright in more files, minor doc fixes.
997
using the HTTPS protocol; HTTPS is considered to be more secure than the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
998
native Git protocol and is preferred.@footnote{The native Git protocol
999
is supported, but not recommended.}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1000
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1001
@cindex URL @subentry for cloning repositories
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1002
To choose which method, you supply a @dfn{URL} for the repo when you
1003
clone it, as follows.
1004
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1005
@example
1006
$ @kbd{git clone https://git.savannah.gnu.org/r/gawk.git} @ii{Clone the repo}
1007
@print{} ...
1008
$ @kbd{cd gawk}                                           @ii{Start working}
1009
@end example
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1010
1011
@emph{You only need to clone the repo once.} From then on, you update its
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1012
contents using other Git commands.  For example, after coming back from
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1013
your vacation in the Bahamas:
1014
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1015
@cindex @command{git} command @subentry @code{git pull}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1016
@example
1017
$ @kbd{cd gawk}               @ii{Move to the repo}
1018
$ @kbd{make distclean}        @ii{A good idea before updating}
1019
@print{} ...
1020
$ @kbd{git pull}              @ii{Update it}
1021
@end example
1022
1023
To build, you should generally follow this recipe:
1024
1025
@example
1026
$ @kbd{./bootstrap.sh && ./configure && make -j && make check}
1027
@end example
1028
1029
@cindex @file{bootstrap.sh} script
1030
@quotation NOTE
1031
Unless you have installed all the tools described in @ref{GNU Tools},
1032
you @emph{must} run @command{./bootstrap.sh} every time you clone a repo,
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1033
do a @samp{git pull} or checkout a different branch.  (In the latter case,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1034
do @samp{make distclean} first.)  Otherwise things will get messy very
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1035
quickly.  The @command{bootstrap.sh} script ensures that all of the file
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1036
time stamps are up to date so that it's not necessary to run the various
1037
configuration tools.
1038
@end quotation
1039
1040
@node Switching Branches
1041
@section Switching Branches
1042
1043
So far, we've been working in the default @code{master} branch.
1044
Let's check what's happening in the @code{gawk-4.1-stable} branch:
1045
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1046
@cindex @command{git} command @subentry @code{git checkout}
1047
@cindex @command{git} command @subentry @code{git pull}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1048
@example
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1049
$ @kbd{make distclean}                          @ii{Clean up}
1050
$ @kbd{git checkout gawk-4.1-stable}            @ii{Checkout a different branch}
1051
@print{} ...
1052
$ @kbd{git pull}                                @ii{Get up to date}
1053
@print{} ...
1054
$ @kbd{./bootstrap.sh && ./configure &&}        @ii{Start working}
1055
> @kbd{make -j && make check}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1056
@end example
1057
1058
@node Starting A New Branch
1059
@section Starting A New Branch
1060
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1061
Let's say you want to work on a new feature.  For example,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1062
you might decide to add Python syntax support.@footnote{Just joking.
1063
Please don't attempt this for real.} You should create a
1064
new branch on which to work.  First, switch back to @code{master}:
1065
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1066
@cindex @command{git} command @subentry @code{git checkout}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1067
@example
1068
$ @kbd{make distclean}
1069
$ @kbd{git checkout master}
1070
@end example
1071
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1072
Now, create a new branch.  The easiest way to do that is
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1073
with the @option{-b} option to @samp{git checkout}:
1074
1075
@example
1076
$ @kbd{git checkout -b feature/python}
1077
@print{} ...
1078
@end example
1079
1080
@cindex @file{ChangeLog} file
1081
@cindex committing changes
1082
You now do massive amounts of work in order to add Python syntax support.
1083
As you do each defined chunk of work, you update the @file{ChangeLog}
1084
file with your changes before @dfn{committing} them to the repo.
1085
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1086
@cindex @command{git} command @subentry @code{git status}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1087
Let's say you've added a new file @file{python.c} and updated several
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1088
others.  Use @samp{git status} to see what's changed:
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1089
1090
@example
1091
$ @kbd{git status}
1092
@print{} ...
1093
@end example
1094
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1095
@cindex @command{git} command @subentry @code{git diff}
1096
@cindex @command{git} command @subentry @code{git difftool}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1097
@cindex @command{meld} utility
1098
Before committing the current set of changes, you can use @samp{git diff}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1099
to view the changes.  You may also use @samp{git difftool}@footnote{Don't
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1100
run @samp{git difftool} in the background; it works interactively.} to run an
1101
external @command{diff} command, such as @command{meld} on GNU/Linux:
1102
1103
@example
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1104
$ @kbd{git diff}                           @ii{Regular built-in tool for standard diffs}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1105
$ @kbd{git difftool --tool=meld}           @ii{GUI diff tool}
1106
@end example
1107
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1108
@cindex @command{git} command @subentry @code{git add}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1109
When you're happy with the changes, use @samp{git add} to tell
1110
Git which of the changed and/or new files you wish to have ready to
1111
be committed:
1112
1113
@example
1114
$ @kbd{git add ...}
1115
@end example
1116
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1117
@cindex @command{git} command @subentry @code{git status}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1118
Use @samp{git status} to see that your changes are scheduled for committing:
1119
1120
@example
1121
$ @kbd{git status}
1122
@print{}
1123
@end example
1124
1125
Now you can commit your changes to your branch:
1126
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1127
@cindex @command{git} command @subentry @code{git commit}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1128
@example
1129
$ @kbd{git commit}
1130
@end example
1131
1132
@noindent
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1133
@cindex @command{git} command @subentry @code{git log}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1134
Running @samp{git commit} causes Git to invoke an editor
1135
(typically from the @env{$EDITOR} environment variable)
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1136
in which you can compose a commit message.  Please supply a
1137
short message summarizing the commit.  This message will be
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1138
visible via @samp{git log}.
1139
1140
@node Undoing a change
1141
@section Undoing A Change
1142
1143
Should you need to undo a change that you have not yet
1144
committed (so that you can start over), you can do so on
1145
per-file basis by simply checking out the file again:
1146
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1147
@cindex @command{git} command @subentry @code{git checkout}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1148
@example
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1149
$ @kbd{git checkout awkgram.y}     @ii{Undo changes to} awkgram.y@ii{.  There is no output}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1150
@end example
1151
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1152
@cindex @command{git} command @subentry @code{git reset}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1153
To start over completely, use @samp{git reset --hard}.
1154
Note that this will @emph{throw away} all your changes, with no
1155
chance for recovery, so be sure you really want to do it.
1156
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1157
@node Saving Without Committing
1158
@section Moving Changes Aside
1159
1160
Sometimes, you may be in the middle of a set of changes that are
1161
not yet completed, when you need to stop what you're doing and work
1162
on something else.  For example, you might be updating the documentation
1163
when a bug report comes in and you want to work on the bug.  But you
1164
can't just switch branches, since you haven't finished your
1165
current changes.
1166
1167
@cindex @command{git} command @subentry @code{git stash}
1168
@cindex @command{git} command @subentry @code{git stash pop}
1169
@cindex @command{git} command @subentry @code{git stash list}
1170
The way to work around this problem is with @samp{git stash}.  This
1171
command saves your changes in a special place within Git from which
1172
they may be restored later.  After executing @samp{git stash},
1173
your current branch is restored to its original, pristine state.
1174
1175
The workflow might go something like this:
1176
1177
@example
1178
$ @kbd{git checkout my-local-branch}                @ii{Checkout a work branch}
1179
...                                           @ii{Do some work}
1180
$ @kbd{git stash}                                   @ii{Save the work aside}
1181
$ @kbd{git checkout gawk-4.1-stable}                @ii{Work on a bug fix}
1182
...                                           @ii{Now we're done}
1183
$ @kbd{git checkout my-local-branch}                @ii{Go back to our local work}
1184
$ @kbd{git stash pop}                               @ii{Restore the earlier changes}
1185
@end example
1186
1187
The stash is maintained as a stack.  Sets of changes are pushed onto the
1188
stack by @samp{git stash} and popped off of it with @samp{git stash pop}.
1189
You may use @samp{git stash list} to see the list of saved changes.
1190
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1191
@node Updating
1192
@section Updating and Merging
1193
1194
As you work on your branch, you will occasionally want to bring it
1195
up to date with respect to @code{master}.
731.9.17 by Andrew J. Schorr
Fix typo in doc/gawkworkflow.texi.
1196
This @value{SECTION} discusses updating local branches
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1197
and handling merge conflicts.
1198
1199
@menu
1200
* Rebasing::                    Rebasing A Local Branch.
1201
* Merge Conflicts::             Dealing With Merge Conflicts.
1202
@end menu
1203
1204
@node Rebasing
1205
@subsection Rebasing A Local Branch
1206
1207
@cindex rebasing
1208
For purely local branches, bringing  your branch up to date is called
1209
@dfn{rebasing}, which causes the branch to look @emph{as if} you had
1210
started from the latest version of @code{master}.  The steps are as
1211
follows:
1212
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1213
@cindex @command{git} command @subentry @code{git rebase}
1214
@cindex @command{git} command @subentry @code{git checkout}
1215
@cindex @command{git} command @subentry @code{git pull}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1216
@example
1217
$ @kbd{git checkout master}                @ii{Checkout} master
1218
$ @kbd{git pull}                           @ii{Update it}
1219
$ @kbd{git checkout feature/python}        @ii{Move back to new, purely local branch}
1220
$ @kbd{git rebase master}                  @ii{``Start over'' from current} master
1221
@end example
1222
1223
@node Merge Conflicts
1224
@subsection Dealing With Merge Conflicts
1225
1226
@cindex conflicts, from merging
1227
@cindex merge conflicts
1228
1229
Sometimes, when merging from @code{master} into your branch, or from
1230
a branch into @code{master}, there will be @dfn{merge conflicts}.
1231
These are one or more areas within a file where there are conflicting
1232
sets of changes, and Git could not do the merge for you.
1233
In this case, the conflicted area will be delimited by the traditional
1234
conflict markers, @samp{<<<}, @samp{===} and @samp{>>>}.
1235
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1236
Your mission then is to edit the file and @dfn{resolve} the conflict
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1237
by fixing the order of additions (such as in a @file{ChangeLog} file),
1238
or fixing the code to take new changes into account.
1239
1240
Once you have done so, you tell Git that everything is OK using
1241
@samp{git add} and @samp{git commit}:
1242
1243
@example
1244
$ @kbd{git checkout feature/python}        @ii{Move back to new, purely local branch}
1245
$ @kbd{git rebase master}                  @ii{``Start over'' from current} master
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1246
@print{} First, rewinding head to replay your work on top of it...
1247
@print{} Applying: Demo change.
1248
@print{} Using index info to reconstruct a base tree...
1249
@print{} M	main.c
1250
@print{} Falling back to patching base and 3-way merge...
1251
@print{} Auto-merging main.c
1252
@print{} CONFLICT (content): Merge conflict in main.c
1253
@print{} error: Failed to merge in the changes.
1254
@print{} Patch failed at 0001 Demo change.
1255
@print{} Use 'git am --show-current-patch' to see the failed patch
1814.1.105 by Arnold D. Robbins
Remove trailing whitespace from a bunch of files.
1256
@print{}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1257
@print{} Resolve all conflicts manually, mark them as resolved with
1258
@print{} "git add/rm <conflicted_files>", then run "git rebase --continue".
1259
@print{} You can instead skip this commit: run "git rebase --skip".
1260
@print{} To abort and get back to the state before "git rebase", run "git rebase --abort".
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1261
$ @kbd{gvim main.c}                        @ii{Edit the file and fix the problem}
1262
$ @kbd{git add main.c}                     @ii{Tell Git everything is OK now @dots{}}
1263
$ @kbd{git commit}                         @ii{@dots{} and it's settled}
1264
$ @kbd{git rebase --continue}              @ii{Continue the rebase}
1265
@end example
1266
1267
The @command{git rebase --continue} then continues the process of
1268
rebasing the current branch that we started in @ref{Rebasing}.
1269
It's not necessary if you are  using @samp{git merge}
1270
(@pxref{Points to remember}).
1271
1272
@node Submitting Changes
1273
@section Submitting Your Changes
1274
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1275
So now your feature is complete.  You've added test cases for it to
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1276
the test suite@footnote{You did do this, didn't you?}, you have
1277
@file{ChangeLog} entries that describe all the changes@footnote{You remembered this, right?},
1278
you have documented the new feature@footnote{You wouldn't neglect this, would you?},
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1279
and everything works great.  You're ready
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1280
to submit the changes for review, and with any luck, inclusion into
1281
@command{gawk}.
1282
1283
@cindex review, changes you made
1284
@cindex changes, submitting for review
1285
There are two ways to submit your changes for review.
1286
1287
@table @emph
1288
@cindex generating a single patch
1289
@cindex patch, single, generation of
1290
@item Generate a single large patch
1291
To do this, simply compare your branch
1292
to the branch off which it is based:
1293
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1294
@cindex @command{git} command @subentry @code{git checkout}
1295
@cindex @command{git} command @subentry @code{git diff}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1296
@example
1297
$ @kbd{git checkout feature/python}
1298
$ @kbd{git diff master > /tmp/python.diff}
1299
@end example
1300
1301
Mail the @file{python.diff} file to the appropriate mailing list
1302
along with a description of what you've changed and why.
1303
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
1304
The patch file will likely contain changes to generated files,
1305
such as @file{awkgram.c} or @file{Makefile.in}.  If you are
1306
comfortable manually editing the patch file to remove those
1307
changes, do so. If not, then send the file as-is and the
1308
maintainer will handle it.
1309
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1310
@cindex @command{git} command @subentry @code{git format-patch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1311
@cindex generating multiple patches
1312
@cindex patches, multiple, generation of
1313
@item Generate a set of patches that in toto comprise your changes
1314
To do this, use @samp{git format-patch}:
1315
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1316
@cindex @command{git} command @subentry @code{git checkout}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1317
@example
1318
$ @kbd{git checkout feature/python}
1319
$ @kbd{git format-patch}
1320
@end example
1321
1322
This creates a set of patch files, one per commit that isn't on the
1323
original branch.  Mail these patches, either separately, or as a set of
1324
attachments, to the appropriate mailing list along with a description
1325
of what you've changed and why.
1326
1327
@end table
1328
1329
Either way you choose to submit your changes, the @command{gawk}
1330
maintainer and development team will review your changes and provide feedback.
1331
If you have signed paperwork with the FSF for @command{gawk} and the maintainer
1332
approves your changes, he will apply the patch(es) and commit the changes.
1333
1334
Which list should you send mail to?  If you are just starting to
1335
contribute, use @email{bug-gawk@@gnu.org}.  After making enough
1336
contributions, you may be invited to join the private @command{gawk}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1337
developers' mailing list.  If you do so, then submit your changes to
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1338
that list.
1339
1340
If you make any substantial changes, you will need to assign copyright
1341
in those changes to the Free Software Foundation before the maintainer
1342
can commit those changes.  @xref{Doing paperwork}, for more information.
1343
1344
@node Removing Branches
1345
@section Removing Branches
1346
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1347
@cindex removing @subentry branches
1348
@cindex branches @subentry removing
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1349
Once the maintainer has integrated your changes, you can get
1350
rid of your local branch:
1351
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1352
@cindex @command{git} command @subentry @code{git checkout}
1353
@cindex @command{git} command @subentry @code{git pull}
1354
@cindex @command{git} command @subentry @code{git branch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1355
@example
1356
$ @kbd{git checkout master}                 @ii{Move to upstream branch}
1357
$ @kbd{git pull}                            @ii{Update}
1358
$ @kbd{gvim ChangeLog ...}                  @ii{Verify your changes are in}
1359
$ @kbd{git branch -d feature/python}        @ii{Remove your local branch}
1360
@end example
1361
1362
@node Points to remember
1363
@section Points to Remember
1364
1365
There are some important points to remember:
1366
1367
@itemize @bullet
1368
@item
1369
Always do a @samp{make distclean} before switching between branches.
1370
Things will get really confused if you don't.
1371
1372
@item
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1373
For upstream branches, @emph{always} work with tracking branches.  @emph{Never}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1374
use @samp{git checkout origin/@var{whatever}}.  Git will happily let
1375
you do something like that, but it's just plain asking for trouble.
1376
1377
@item
1378
Make sure your tracking branches are up-to-date before doing anything
1379
with them, particularly using them as the basis for a rebase
1380
or merge.  This typically means a three-step process:
1381
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1382
@cindex @command{git} command @subentry @code{git checkout}
1383
@cindex @command{git} command @subentry @code{git pull}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1384
@example
1385
$ @kbd{git checkout master}             @ii{Get to local copy}
1386
$ @kbd{git pull}                        @ii{Bring it up to date}
1387
$ @kbd{git checkout feature/python}     @ii{Go back to your branch}
1388
@end example
1389
1390
@noindent
1391
You can then do the actual rebase:
1392
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1393
@cindex @command{git} command @subentry @code{git rebase}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1394
@example
1395
$ @kbd{git rebase master}               @ii{Now rebase your feature off of master}
1396
@end example
1397
1398
@item
1399
Git always treats the currently checked-out branch as the object of
1400
operations.  For example, when comparing files with the regular
1401
@command{diff} command, the usage is @samp{diff @var{oldfile} @var{newfile}}.
1402
For @samp{git diff}, the current branch takes the place of @var{newfile}, thus:
1403
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1404
@cindex @command{git} command @subentry @code{git checkout}
1405
@cindex @command{git} command @subentry @code{git diff}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1406
@example
1407
$ @kbd{git checkout feature/python}
1408
$ @kbd{git diff master}                 @ii{Compare} master @ii{to current branch}
1409
@end example
1410
1411
@noindent
1412
or if merging:
1413
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1414
@cindex @command{git} command @subentry @code{git checkout}
1415
@cindex @command{git} command @subentry @code{git pull}
1416
@cindex @command{git} command @subentry @code{git merge}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1417
@example
1418
$ @kbd{git checkout master}             @ii{Checkout} master
1419
$ @kbd{git pull}                        @ii{Update tracking branch}
1420
$ @kbd{git merge feature/python}        @ii{Merge changes into} master
1421
@end example
1422
1423
@end itemize
1424
1425
@node Development with commit access
1426
@chapter Development With Commit Access
1427
1428
This @value{CHAPTER} describes how to do development when you @emph{do}
1429
have commit access to the @command{gawk} repo on Savannah.
1430
1431
@menu
1432
* Initial setup::                   Getting started with commit access.
1433
* ssh clone::                       Cloning using an @samp{ssh://} URL.
1434
* Developing patches::              Developing patches.
1435
* Developing new features::         Developing new features.
1436
* Developing fixes::                Developing fixes.
1437
@end menu
1438
1439
@node Initial setup
1440
@section Initial Setup
1441
1442
Congratulations!  After becoming a quality contributor to @command{gawk}
1443
development, you've been invited to join the private development list
1444
and to accept having commit access to the repo.
1445
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1446
@cindex Savannah @subentry creating an account
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1447
@cindex account, Savannah, creation of
1448
@cindex @code{ssh} key
1449
The first thing to do is to create an account on Savannah, choosing a
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1450
unique user name.  To do so, go to the @uref{http://savannah.gnu.org,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1451
Savannah home page} and click on the ``New User'' link.  The setup
1452
will include uploading of your @command{ssh} key, as per the instructions
1453
on the Savannah web page.
1454
1455
After you've done all this, send email to the maintainer with your
1456
Savannah user name, and he will add you to the list of users who have
1457
commit access to the repo.
1458
1459
@node ssh clone
1460
@section Cloning The Repo With An @command{ssh} URL
1461
1462
In order to be able to commit changes to the repo, you must
1463
clone it using an @samp{ssh://} URL.
1464
Cloning the repo with @command{ssh} is similar to cloning
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1465
with HTTPS, but the URL is different:
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1466
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1467
@cindex @command{git} command @subentry @code{git clone}
1468
@cindex URL @subentry for @command{gawk} repository
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1469
@cindex Repository, @command{gawk}, URL for
1470
@example
1471
$ @kbd{git clone ssh://yourname@@git.sv.gnu.org/srv/git/gawk.git}
1472
@print{} ...
1473
@end example
1474
1475
Here, you should replace @samp{yourname} in the command with the user
1476
name you chose for use on Savannah.
1477
1478
@node Developing patches
1479
@section Developing Patches
1480
1481
The first part of developing a patch is the same as for developers
1482
without commit access:
1483
1484
@enumerate 1
1485
@item
1486
Develop the code and test it.
1487
1488
@item
1489
@cindex @file{ChangeLog} file
1490
Update the @file{ChangeLog}.
1491
1492
@item
1493
@cindex documentation files
1494
@cindex @file{gawktexi.in} documentation
1495
@cindex @file{gawk.1} manual page
1496
If necessary, update the documentation: @file{doc/gawktexi.in}
1497
and/or @file{doc/gawk.1}.
1498
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1499
@cindex @command{git} command @subentry @code{git diff}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1500
@item
1501
Use @samp{git diff > mychange.diff} to create a patch file.
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
1502
(If you want, remove the diffs for generated files.)
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1503
1504
@item
1505
Send it to the mailing list for discussion.
1506
1507
@item
1508
Iterate until the patch is ready to be committed.
1509
@end enumerate
1510
1511
However, now that you have commit access, you can commit the fix and push
1512
it up to the repo yourself!
1513
Let's assume you've made a bug fix directly on @code{master}.
1514
Here's how to commit your changes:
1515
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1516
@cindex @command{git} command @subentry @code{git diff}
1517
@cindex @command{git} command @subentry @code{git add}
1518
@cindex @command{git} command @subentry @code{git commit}
1519
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1520
@example
1521
$ @kbd{git diff}            @ii{Review the patch one more time}
1522
$ @kbd{git add @dots{}}         @ii{Add any files for committing}
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1523
$ @kbd{git commit}          @ii{Commit the files, with a commit message}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1524
$ @kbd{git push}            @ii{Push the files up to the repo.  Ta da!}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1525
@end example
1526
1527
The first three steps are the same described earlier
1528
(@pxref{Starting A New Branch}).
1529
The @samp{git push} is what's new, and it updates the repo on
1530
Savannah.  Congratulations!
1531
1532
As a courtesy, you should send a note to the mailing list indicating
1533
that you have pushed your change.
1534
1535
@node Developing new features
1536
@section Developing New Features
1537
1538
Developing a new feature can be easier once you have commit access
1539
to the repo.  First, create a new branch to hold your feature:
1540
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1541
@cindex @command{git} command @subentry @code{git checkout}
1542
@cindex @command{git} command @subentry @code{git pull}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1543
@example
1544
$ @kbd{git checkout master}                     @ii{Start from} master
1545
$ @kbd{git pull}                                @ii{Be sure to be up to date}
1546
$ @kbd{git checkout -b feature/python}          @ii{Create and switch to a new branch}
1547
@end example
1548
1549
Now, you can develop as normal, adding new files if necessary (such as new tests),
1550
modifying code, updating the @file{ChangeLog} and documentation, and so on.
1551
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1552
You can share changes with the mailing list as diffs, as usual.  However, especially
1553
for a large feature, it would be better to push your branch up to Savannah.  Then,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1554
everyone else can simply pull it down to their local systems and review your
1555
changes at their leisure.
1556
1557
To push your branch up initially:
1558
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1559
@cindex @command{git} command @subentry @code{git diff}
1560
@cindex @command{git} command @subentry @code{git add}
1561
@cindex @command{git} command @subentry @code{git commit}
1562
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1563
@example
1564
$ @kbd{git diff}                                @ii{Review your changes}
1565
$ @kbd{git add @dots{}}                             @ii{Add any files for committing}
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1566
$ @kbd{git commit}                              @ii{Commit the files with a commit message}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1567
$ @kbd{git push -u origin feature/python}       @ii{Push the branch up to the repo}
1568
@end example
1569
1570
When you use @samp{push -u origin}, Git helpfully converts
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1571
your purely local branch into a tracking branch.  It becomes
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1572
as if the branch had originated from the upstream repo
1573
and you checked it out locally.
1574
1575
@emph{You only need to do @samp{git push -u origin} once.}
1576
As you continue to work on your branch, the workflow simplifies
1577
into this:
1578
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1579
@cindex @command{git} command @subentry @code{git diff}
1580
@cindex @command{git} command @subentry @code{git add}
1581
@cindex @command{git} command @subentry @code{git commit}
1582
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1583
@example
1584
$ @kbd{git diff}                @ii{Review your changes}
1585
$ @kbd{git add @dots{}}             @ii{Add any files for committing}
1586
$ @kbd{git commit}              @ii{Commit the files}
1587
$ @kbd{git push}                @ii{Push your changes to the branch upstream}
1588
@end example
1589
1590
@node Developing fixes
1591
@section Developing Fixes
1592
1593
If you want to make a fix on @code{master} or on the current
1594
stable branch, you work the same way, by producing and discussing
1595
a diff on the mailing list.  Once it's approved, you can commit it
1596
yourself:
1597
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1598
@cindex @command{git} command @subentry @code{git checkout}
1599
@cindex @command{git} command @subentry @code{git pull}
1600
@cindex @command{git} command @subentry @code{git add}
1601
@cindex @command{git} command @subentry @code{git commit}
1602
@cindex @command{git} command @subentry @code{git diff}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1603
@example
1604
$ @kbd{git checkout master}     @ii{Move to} master
1605
$ @kbd{git pull}                @ii{Make sure we're up to date with the maintainer}
1606
$ @kbd{gvim @dots{}}                @ii{Make any fixes, compile, test}
1607
$ @kbd{git diff}                @ii{Review your changes}
1608
$ @kbd{git add @dots{}}             @ii{Add any files for committing}
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1609
$ @kbd{git commit}              @ii{Commit the files with a commit message.}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1610
@end example
1611
1612
When you're ready to push your changes:
1613
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1614
@cindex @command{git} command @subentry @code{git pull}
1615
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1616
@example
1617
$ @kbd{git pull}                @ii{Download latest version; Git will merge}
1618
$ @kbd{gvim ...}                @ii{Resolve any merge conflicts with} git add @ii{and} git commit
1619
$ @kbd{git push}                @ii{Now you can push your changes upstream}
1620
@end example
1621
1622
@xref{Merge Conflicts} for instructions on dealing with merge conflicts.
1623
1624
@node General practices
1625
@chapter General Development Practices
1626
1627
This @value{CHAPTER} discusses general practices for @command{gawk} development.
1628
The discussion here is mainly for developers with commit access to the
1629
Savannah repo.
1630
1631
@table @dfn
1632
@cindex propagating fixes to other branches
1633
@cindex fixes, propagating to other branches
1634
@item Propagating Fixes
1635
Usually, bug fixes should be made on the current ``stable'' branch.
1636
Once a fix has been reviewed and approved, you can commit it and
1637
push it yourself.
1638
Typically, the maintainer then takes care to merge the fix to @code{master}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1639
and from there to any other branches.  However, you are welcome to
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1640
save him the time and do this yourself.
1641
1642
@cindex directory ownership
1643
@cindex ownership of directories
1644
@item Directory ownership
1645
Some developers ``own'' certain parts of the tree, such as the @file{pc} and @file{vms} directories.
1646
They are allowed to commit changes to those directories without review by the mailing
1647
list, but changes that also touch the mainline code should be submitted for review.
1648
1649
@item New feature development
1650
Unless you can convince the maintainer (and the other developers!) otherwise,
1651
you should @emph{always} start branches for new features from @code{master},
1652
and not from the current ``stable'' branch.
1653
1814.1.116 by Arnold D. Robbins
Updates to gawk workflow doc.
1654
Use @samp{git checkout -b feature/@var{feature_name}} to create the initial branch.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1655
You may then elect to keep it purely local, or to push it up to Savannah for
1656
review, even if the feature is not yet totally ``ready for prime time.''
1657
@end table
1658
1659
During development of a new feature, you will most likely wish to keep your
1660
feature branch up to date with respect to ongoing improvements in @code{master}.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1661
This is generally easy to do.  There are two different mechanisms, and which
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1662
one you use depends upon the nature of your new feature branch.
1663
1664
@table @dfn
1665
@item As long as your branch is purely local
1666
You should use @samp{git rebase}
1667
to the keep the branch synchronized with the original branch from which it was forked:
1668
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1669
@cindex @command{git} command @subentry @code{git checkout}
1670
@cindex @command{git} command @subentry @code{git pull}
1671
@cindex @command{git} command @subentry @code{git rebase}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1672
@example
1673
$ @kbd{git checkout master}             @ii{Move to} master
1674
$ @kbd{git pull}                        @ii{Bring it up to date}
1675
$ @kbd{git checkout feature/python}     @ii{Move to your new feature branch}
1676
$ @kbd{git rebase master}               @ii{Rebase from} master
1677
@end example
1678
1679
@noindent
1680
The rebasing operation may require that you resolve conflicts
1681
(@pxref{Merge Conflicts}).
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1682
Edit any conflicted files and resolve the problem(s).  Compile and
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1683
test your changes, then use @samp{git add}
1684
and @samp{git commit} to indicate resolution, and then use
1685
@samp{git rebase --continue} to continue the rebasing.
1686
Git is very good about providing short instructions on how to
1687
continue when such conflicts occur.
1688
1689
@item Once the branch has been pushed up to Savannah
1690
You @emph{must} use @samp{git merge} to bring your feature branch up
1691
to date.  That flow looks like this:
1692
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1693
@cindex @command{git} command @subentry @code{git checkout}
1694
@cindex @command{git} command @subentry @code{git pull}
1695
@cindex @command{git} command @subentry @code{git merge}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1696
@example
1697
$ @kbd{git checkout master}             @ii{Move to} master
1698
$ @kbd{git pull}                        @ii{Bring it up to date}
1699
$ @kbd{git checkout feature/python}     @ii{Move to your new feature branch}
1700
$ @kbd{git merge master}                @ii{Merge from} master
1701
@end example
1702
1703
@noindent
1704
Here too, you may have to resolve any merge conflicts
1705
(@pxref{Merge Conflicts}).
1706
Once that's done, you can push the changes up to Savannah.
1707
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1708
@end table
1709
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1710
When the changes on your branch are complete, usually the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1711
maintainer merges the branch to @code{master}.  But
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1712
there's really no magic involved, the merge is simply
1713
done in the other direction:
1714
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1715
@cindex @command{git} command @subentry @code{git checkout}
1716
@cindex @command{git} command @subentry @code{git pull}
1717
@cindex @command{git} command @subentry @code{git merge}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1718
@example
1719
$ @kbd{git checkout feature/python}     @ii{Checkout feature branch}
1720
$ @kbd{git pull}                        @ii{Bring it up to date}
1721
$ @kbd{git checkout master}             @ii{Checkout} master
1722
$ @kbd{git pull}                        @ii{Bring it up to date}
1723
$ @kbd{git merge feature/python}        @ii{Merge from} feature/python @ii{into} master
1724
@end example
1725
1726
If you've been keeping @samp{feature/python} in sync with
1727
@code{master}, then there should be no merge conflicts to
1728
resolve, and you can push the result to Savannah:
1729
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1730
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1731
@example
1732
$ @kbd{git push}                        @ii{Push up to Savannah}
1733
@end example
1734
1735
Since @samp{feature/python} is no longer needed, it can be
1736
gotten rid of:
1737
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1738
@cindex @command{git} command @subentry @code{git branch}
1739
@cindex @command{git} command @subentry @code{git push}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1740
@example
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1741
$ @kbd{git branch}                                  @ii{Still on} master
1742
  @dots{}
1743
* master
1744
$ @kbd{git branch -d feature/python}                @ii{Delete feature branch}
1745
$ @kbd{git push -u origin --delete feature/python}  @ii{Delete on Savannah}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1746
@end example
1747
1748
The @samp{git push} command deletes the @code{feature/python}
1749
branch from the Savannah repo.
1750
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1751
@cindex @command{git} command @subentry @code{git fetch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1752
@noindent
1753
Finally, you should send an email to developer's list describing
1754
what you've done so that everyone else can delete their
1755
copies of the branch and do a @samp{git fetch --prune}
1756
(@pxref{Repo Maintenance}).
1757
1758
To update the other remaining development branches
1759
with the latest changes on @code{master}, use the
1760
@samp{helpers/update-branches.sh} script in the repo.
1761
1762
@node Repo Maintenance
1763
@chapter Keeping Your Repo Organized
1764
1765
There are a few commands you should know about to help keep
1766
your local repo clean.
1767
1768
@table @emph
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1769
@cindex removing @subentry old branches
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1770
@cindex old branches, removing
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1771
@cindex branches @subentry removing
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1772
@item Removing old branches
1773
Developers add branches to the Savannah repo and when development
1774
on them is done, they
1775
get merged into @code{master}.  Then the branches on Savannah are
1776
deleted (as shown in @ref{General practices}).
1777
1778
However, your local copies of those branches (labelled with the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1779
@samp{origin/} prefix) remain in your local repo.  If you don't
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1780
need them, then you can clean up your repo as follows.
1781
1782
First, remove any related tracking branch you may have:
1783
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1784
@cindex @command{git} command @subentry @code{git pull}
1785
@cindex @command{git} command @subentry @code{git branch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1786
@example
1787
$ @kbd{git pull}                                @ii{Get up to date}
1788
$ @kbd{git branch -d feature/merged-feature}    @ii{Remove tracking branch}
1789
@end example
1790
1791
Then, ask Git to clean things up for you:
1792
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1793
@cindex @command{git} command @subentry @code{git fetch}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1794
@example
1795
$ @kbd{git fetch --prune}                       @ii{Remove unneeded branches}
1796
@end example
1797
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1798
@cindex removing @subentry cruft
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1799
@cindex cruft, removing
1800
@item Removing cruft
1801
As Git works, occasional ``cruft'' collects in the repository.
1802
Git does occasionally clean this out on its own, but if you're
1803
concerned about disk usage, you can do so yourself
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1804
using @samp{git gc} (short for ``garbage collect'').  For
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1805
example:
1806
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1807
@cindex @command{git} command @subentry @code{git gc}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1808
@example
1809
$ @kbd{du -s .}                               @ii{Check disk usage}
1810
@print{} 99188   .                            @ii{Almost 10 megabytes}
1811
$ @kbd{git gc}                                @ii{Collect garbage}
1812
@print{} Counting objects: 32114, done.
1813
@print{} Delta compression using up to 4 threads.
1814
@print{} Compressing objects: 100% (6370/6370), done.
1815
@print{} Writing objects: 100% (32114/32114), done.
1816
@print{} Total 32114 (delta 25655), reused 31525 (delta 25231)
1817
$ @kbd{du -s .}                               @ii{Check disk usage again}
1818
@print{} 75168   .                            @ii{Down to 7 megabytes}
1819
@end example
1820
1821
@cindex renaming branches
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
1822
@cindex branches @subentry renaming
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1823
@item Renaming branches
1824
Occasionally you may want to rename a branch.@footnote{This discussion
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1825
is adopted from
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1826
@uref{https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git, here}.}
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
1827
If your branch is local and you are on it, use:
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1828
1829
@example
1830
$ @kbd{git branch -m feature/@var{new-name}}
1831
@end example
1832
1833
@noindent
1834
Otherwise, use:
1835
1836
@example
1837
$ @kbd{git branch -m feature/@var{old-name} feature/@var{new-name}}
1838
@end example
1839
1840
You then need to fix the upstream repo.  This command does so,
1841
using an older syntax to simultaneously delete the old name and
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1842
push the new name.  You should be on the new branch:
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1843
1844
@example
1845
$ @kbd{git push origin :feature/@var{old-name} feature/@var{new-name}}
1846
@end example
1847
1848
@quotation NOTE
1849
It is the leading @samp{:} in the first branch name that causes
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1850
Git to delete the old name in the upstream repo.  Don't omit it!
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1851
@end quotation
1852
1853
Finally, reset the upstream branch for the local branch
1854
with the new name:
1855
1856
@example
1857
$ @kbd{git push -u origin feature/@var{new-name}}
1858
@end example
1859
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1860
You should also update the mailing list to let the other
1861
developers know what's happening.
1862
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1863
@end table
1864
1865
@node Development Stuff
1866
@chapter Development Stuff
1867
1868
This @value{CHAPTER} discusses other things you need to know and/or do
1869
if you're going to participate seriously in @command{gawk} development.
1870
1871
@menu
1872
* Coding style::                Where to read up on the coding style.
1873
* Doing paperwork::             Legal stuff in order to contribute.
1874
* Tools::                       Tools to have on your system for development.
1875
* Debugging::                   Compiling for debugging.
1876
@end menu
1877
1878
@node Coding style
1879
@section Coding Style
1880
1881
@cindex coding style
1882
You should read the discussion about adding code in the @command{gawk}
1883
documentation.
1884
@ifnothtml
1885
@xref{Additions, Additions, Making Additions to @command{gawk}, gawk, GAWK: Effective awk Programming},
1886
for a discussion of the general procedure.  In particular, pay attention to the
1814.1.105 by Arnold D. Robbins
Remove trailing whitespace from a bunch of files.
1887
coding style guidelines in
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1888
@ref{Adding Code, Adding Code, Adding New Features, gawk, GAWK: Effective awk Programming}.@footnote{Changes that don't follow the coding
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1889
style guidelines won't be accepted.  Period.}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1890
These two sections may also be found online, at
1891
@uref{https://www.gnu.org/software/gawk/manual/html_node/Additions.html#Additions}, and
1892
@uref{https://www.gnu.org/software/gawk/manual/html_node/Adding-Code.html#Adding-Code},
1893
respectively.
1894
@end ifnothtml
1895
@ifhtml
1896
See @uref{https://www.gnu.org/software/gawk/manual/html_node/Additions.html#Additions,
1897
the section @cite{Making Additions to @command{gawk}}}, in the online documentation
1898
for a discussion of the general procedure.  In particular, pay attention to the
1814.1.105 by Arnold D. Robbins
Remove trailing whitespace from a bunch of files.
1899
coding style guidelines in
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1900
@uref{https://www.gnu.org/software/gawk/manual/html_node/Adding-Code.html#Adding-Code,
1901
the section @cite{Adding New Features}}, also in the online documentation.
1902
@end ifhtml
1903
1904
@node Doing paperwork
1905
@section Assigning Copyrights to the FSF
1906
1907
@cindex assigning copyright
1908
@cindex copyright, assignment
1909
For any change of more than just a few lines, you will need to assign
1910
copyright in (that is, ownership of) those changes to the Free Software
1911
Foundation.
1912
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1913
This is generally an easy thing to do.  In particular, you can choose to
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1914
use a version of the copyright assignment which assigns all your current
1915
@emph{and future} changes to @command{gawk} to the FSF.  This means
1916
that you only need to do the paperwork once, and from then on all your
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1917
changes will automatically belong to the FSF.  The maintainer recommends
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1918
doing this.
1919
1920
The maintainer will help you with this process once you have a
1921
contribution that warrants it.
1922
1923
@node Tools
1924
@section Software Tools You Will Need
1925
1926
@cindex software tools
1927
This @value{SECTION} discusses additional tools that you may need to
1928
install on your system in order to be in sync with what the @command{gawk}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1929
maintainer uses.  It also discusses different C compiler options for use
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1930
during code development, and how to compile @command{gawk} for debugging.
1931
1932
@menu
1933
* GNU Tools::                   The GNU Autotools.
1934
* Compilers::                   A discussion of compilers that can be used.
1935
@end menu
1936
1937
@node GNU Tools
1938
@subsection GNU Tools
1939
1940
@cindex GNU software tools
1941
@cindex autotools
1942
If you expect to work with the configuration files and/or the
1943
@file{Makefile} files, you will need to install a number of other GNU
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1944
tools.  In general, you should be using the latest versions of the tools,
1945
or least the same ones that the maintainer himself uses.  This helps
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1946
minimize the differences that the maintainer has to resolve when merging
1947
changes, and in general avoids confusion and hassle.
1948
Similarly, you should install the latest GNU documentation tools as well.
1949
The tools are described in the following list:
1950
1951
@table @command
1952
@cindex @command{autoconf}
1953
@cindex GNU @command{autoconf}
1954
@cindex @file{configure.ac} file
1955
@item autoconf
1956
GNU Autoconf processes the @file{configure.ac} files in order to
1957
generate the @file{configure} shell script and @file{config.h.in}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1958
input file.  See @uref{https://www.gnu.org/software/autoconf/autoconf.html,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1959
the Autoconf home page} for more information.
1960
1961
@cindex @command{automake}
1962
@cindex GNU @command{automake}
1963
@cindex @file{Makefile.am} file
1964
@item automake
1965
GNU Automake processes the @file{configure.ac} and @file{Makefile.am}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1966
files to produce @file{Makefile.in} files.  See @uref{https://www.gnu.org/software/automake,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1967
the Automake home page} for more information.
1968
1969
@cindex @command{gettext}
1970
@cindex GNU @command{gettext}
1971
@cindex @file{gawk.pot} file
1972
@item gettext
1973
GNU Gettext processes the @command{gawk} source code to produce the
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1974
original @file{po/gawk.pot} message template file.  Normally you
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1975
should not need need to do this; the maintainer usually
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1976
manages this task.  See @uref{https://www.gnu.org/software/gettext,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1977
the Gettext home page} for more information.
1978
1979
@cindex @command{libtool}
1980
@cindex GNU @command{libtool}
1981
@cindex extensions, @command{gawk}
1982
@item libtool
1983
GNU Libtool works with Autoconf and Automake to produce portable
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1984
shared libraries.  It is used for the extensions that ship with @command{gawk},
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1985
whose code is in the @file{extensions} directory.
1986
See @uref{https://www.gnu.org/software/libtool, the Libtool home page}
1987
for more information.
1988
1989
@cindex @command{makeinfo}
1990
@cindex GNU @command{makeinfo}
1991
@cindex @command{Texinfo}
1992
@cindex GNU Texinfo
1993
@item makeinfo
1994
The @command{makeinfo} command is used to build the Info versions of
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1995
the documentation.  You need to have the same version as the maintainer
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1996
uses, so that when you make a change to the documentation, the corresponding
1721 by Arnold D. Robbins
Start on workflow doc improvements.
1997
change to the generated Info file will be minimal.  @command{makeinfo} is
1998
part of GNU Texinfo.  See @uref{https://www.gnu.org/software/texinfo,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
1999
the Texinfo home page} for more information.
2000
2001
@end table
2002
2003
@node Compilers
2004
@subsection Compilers
2005
2006
@cindex compilers
2007
@cindex GCC, the GNU Compiler Collection
2008
The default compiler for @command{gawk} development is GCC, the
2009
@uref{https://gcc.gnu.org, GNU Compiler Collection}.
2010
The default version of GCC is whatever is on the
2011
maintainer's personal GNU/Linux system, although he does try to build
2012
the latest released version if that is newer than what's
2013
on his system, and then occasionally test @command{gawk} with it.
2014
2015
@cindex @command{clang} compiler
2016
He also attempts to test occasionally with @uref{https://clang.llvm.org/,
2017
@command{clang}}.  However, he uses whatever is the default for his
2018
GNU/Linux system, and does @emph{not} make an effort to build the current
2019
version for testing.
2020
2021
Both GCC and @command{clang} are highly optimizing compilers that produce
2022
good code, but are very slow.  There are two other compilers that
2023
are faster, but that may not produce quite as good code.  However, they
2024
are both reasonable for doing development.
2025
2026
@table @emph
2027
@cindex @command{tcc} compiler
2028
@cindex Tiny C compiler
2029
@item The Tiny C Compiler, @command{tcc}
2030
This compiler is @emph{very} fast, but it produces only mediocre code.
2031
It is capable of compiling @command{gawk}, and it does so well enough
2032
that @samp{make check} runs without errors.
2033
2034
However, in the past the quality has varied, and the maintainer has
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2035
had problems with it.  He recommends using it for regular development,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2036
where fast compiles are important, but rebuilding with GCC before doing
2037
any commits, in case @command{tcc} has missed something.@footnote{This
2038
bit the maintainer once.}
2039
2040
See @uref{http://www.tinycc.org, the project's home page} for
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2041
some information.  More information can be found in the project's
2042
@uref{http://repo.or.cz/tinycc.git, Git repository}.  The maintainer builds
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2043
from the @code{mob} branch for his work, but after updating it you should
2044
check that this branch still works to compile @command{gawk} before
2045
installing it.
2046
2047
@cindex @command{pcc} compiler
2048
@cindex Portable C compiler
2049
@item The (Revived) Portable C Compiler
2050
This is an updated version of the venerable Unix Portable C Compiler,
2051
PCC.  It accepts ANSI C syntax and supports both older and modern
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2052
architectures.  It produces better code than @command{tcc} but is slower,
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2053
although still much faster than GCC and @command{clang}.
2054
2055
See @uref{http://pcc.ludd.ltu.se, the project's home page} for more
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2056
information.  See @uref{http://pcc.ludd.ltu.se/supported-platforms}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2057
for instructions about obtaining the code using CVS and building it.
2058
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
2059
@cindex @command{pcc} compiler @subentry Git mirror
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2060
An alternative location for the source is the @command{gawk}
2061
maintainer's @uref{https://github.com/arnoldrobbins/pcc-revived,
1814.1.105 by Arnold D. Robbins
Remove trailing whitespace from a bunch of files.
2062
Git mirror} of the code.  If you're using Ubuntu GNU/Linux 18.04
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
2063
or later, you need to use the @code{ubuntu-18} branch from this
2064
Git mirror.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2065
@end table
2066
2067
@node Debugging
2068
@section Compiling For Debugging
2069
2070
@cindex debugging, compiling for
2071
@cindex compiling for debugging
2072
If you wish to compile for debugging, you should use GCC.  After
2073
running @command{configure} but before running @command{make}, edit the
2074
@file{Makefile} and remove the @option{-O2} flag from the definition of
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2075
@code{CFLAGS}.  Optionally, do the same for @file{support/Makefile} and/or
2076
@file{extensions/Makefile}.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2077
Then run @command{make}.
2078
2079
@cindex @file{.developing} file
2080
You can enable additional debugging code by creating a file
2081
named @file{.developing} in the @command{gawk} source code directory
2082
@emph{before} running @command{configure}.  Doing so enables additional
2083
conditionally-compiled debugging code within @command{gawk}, and adds
2084
additional warning and debugging options if compiling with GCC.
1355 by Arnold D. Robbins
Small updates in gawkworkflow.texi.
2085
It also disables optimization.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2086
2087
@node Cheat Sheet
2088
@appendix Git Command Cheat Sheet
2089
2090
This @value{APPENDIX} provides an alphabetical list of the Git commands
2091
cited in this @value{DOCUMENT}, along with brief descriptions of
2092
what the commands do.
2093
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
2094
@cindex @command{git} command @subentry @code{git help}
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2095
@cindex @option{--help} option for @command{git}
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
2096
@cindex @command{git} command @subentry @option{--help} option
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2097
Note that you may always use either @samp{git help @var{command}}
2098
or @samp{git @var{command} --help} to get short, man-page style
2099
help on how to use any given Git command.
2100
2101
@table @code
2102
@item git add
2103
Add a file to the list of files to be committed.
2104
2105
@item git branch
2106
View existing branches, or delete a branch.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2107
The most useful options are @option{-a} and @option{-d}.
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2108
2109
@item git checkout
2110
Checkout an existing branch, create a new branch, or checkout a file to
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2111
reset it.  Use the @option{-b} option to create and checkout a
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2112
new branch in one operation.
2113
2114
@item git clone
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2115
Clone (make a new copy of) an existing repository.  You generally
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2116
only need to do this once.
2117
2118
@item git commit
2119
Commit changes to files which have been staged for committing
2120
with @samp{git add}.
2121
This makes your changes permanent, @emph{in your local repository only}.
2122
To publish your changes to an upstream repo, you must use @samp{git push}.
2123
2124
@item git config
2125
Display and/or change global and/or local configuration settings.
2126
2127
@item git diff
2128
Show a unified-format diff of what's changed in the current directory
2129
as of the last commit.  It helps to have Git configured to use
2130
its builtin pager for reviewing diffs (@pxref{Configuring git}).
2131
2132
@item git difftool
2133
Use a ``tool'' (usually a GUI-based program) to view differences,
2134
instead of the standard textual diff as you'd get from @samp{git diff}.
2135
2136
@item git fetch
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2137
Update your local copy of the upstream's branches.  That is,
2138
update the various @samp{origin/} branches.  This leaves your
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2139
local tracking branches unchanged.
2140
With the @option{--prune} option, this removes any copies
2141
of stale @samp{origin/} branches.
2142
2143
@item git format-patch
2144
Create a series of patch files, one per commit not on the
2145
original branch from which you started.
2146
2147
@item git gc
2148
Run a ``garbage collection'' pass in the current repository.
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2149
This can often reduce the space used in a large repo.  For
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2150
@command{gawk} it does not make that much difference.
2151
2152
@item git help
2153
Print a man-page--style usage summary for a command.
2154
2155
@item git log
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2156
Show the current branch's commit log.  This includes who
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2157
made the commit, the date, and the commit message.
2158
Commits are shown from newest to oldest.
2159
2160
@item git merge
2161
Merge changes from the named branch into the current one.
2162
2163
@item git pull
2164
When in your local tracking branch @code{@var{xxx}},
2165
run @samp{git fetch}, and then merge from @code{origin/@var{xxx}}
2166
into @code{@var{xxx}}.
2167
2168
@item git push
2169
Push commits from your local tracking branch @code{@var{xxx}}
2170
through @code{origin/@var{xxx}} and on to branch @code{@var{xxx}}
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2171
in the upstream repo.  Use @samp{git push -u origin --delete @var{xxx}} to delete
2172
an upstream branch.  (Do so carefully!)
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2173
2174
@item git rebase
2175
Rebase the changes in the current purely local branch to
2176
look as if they had been made relative to the latest
2177
commit in the current upstream branch (typically @code{master}).
2178
This is how you keep your local, in-progress changes up-to-date
2179
with respect to the original branch from which they were started.
2180
2181
@item git reset
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
2182
@cindex @command{git} command @subentry @code{git reset} @subentry @option{--hard} option
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2183
Restore the original state of the repo, especially with the
2184
@option{--hard} option.  Read up on this command, and use it carefully.
2185
1724 by Arnold D. Robbins
Updates to gawkworkflow.texi.
2186
@item git stash
1721 by Arnold D. Robbins
Start on workflow doc improvements.
2187
@cindex @command{git} command @subentry @code{git stash}
2188
Save your current changes in a special place within Git.  They can
2189
be restored with @samp{git stash pop}, even on a different branch.
2190
Use @samp{git stash list} to see the list of stashed changes.
2191
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2192
@item git status
2193
Show the status of files that are scheduled to be committed,
2194
and those that have been modified but not yet scheduled for committing.
2195
Use @samp{git add} to schedule a file for committing.
2196
This command also lists untracked files.
2197
2198
@end table
2199
2200
@node Resources
2201
@appendix Git Resources
2202
2203
@cindex @cite{Pro Git} book
2204
There are many Git resources available on the Internet.
2205
Start at the @uref{http://git-scm.org, Git Project home page}.
2206
In particular, the @uref{https://git-scm.com/book/en/v2,
2207
@cite{Pro Git} book} is available online.
2208
1379 by Arnold D. Robbins
Revise indexing in gawkworkflow.texi.
2209
@cindex Savannah @subentry using Git guide
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2210
See also @uref{http://savannah.gnu.org/maintenance/UsingGit,
2211
the Savannah quick introduction to Git}.
2212
1472.1.5 by Arnold D. Robbins
Add a resource in gawkworkflow.texi.
2213
A nice article on how Git works is
2214
@uref{http://jwiegley.github.io/git-from-the-bottom-up/,
2215
@cite{Git From The Bottom Up}}, by John Wiegley.
2216
731.3.75 by Arnold D. Robbins
Remove using-git.texi. Add gawkworkflow.texi.
2217
@node TODO
2218
@appendix Stuff Still To Do In This Document
2219
2220
@itemize @bullet
2221
@item
2222
Fill out all examples with full output
2223
2224
@end itemize
2225
2226
@ifnotdocbook
2227
@node Index
2228
@unnumbered Index
2229
@end ifnotdocbook
2230
@printindex cp
2231
2232
@bye