1PERLGIT(1) Perl Programmers Reference Guide PERLGIT(1)
2
3
4
6 perlgit - Detailed information about git and the Perl repository
7
9 This document provides details on using git to develop Perl. If you are
10 just interested in working on a quick patch, see perlhack first. This
11 document is intended for people who are regular contributors to Perl,
12 including those with write access to the git repository.
13
15 All of Perl's source code is kept centrally in a Git repository at
16 github.com.
17
18 You can make a read-only clone of the repository by running:
19
20 % git clone git://github.com/Perl/perl5.git perl
21
22 This uses the git protocol (port 9418).
23
24 If you cannot use the git protocol for firewall reasons, you can also
25 clone via http:
26
27 % git clone https://github.com/Perl/perl5.git perl
28
30 Once you have changed into the repository directory, you can inspect
31 it. After a clone the repository will contain a single local branch,
32 which will be the current branch as well, as indicated by the asterisk.
33
34 % git branch
35 * blead
36
37 Using the -a switch to "branch" will also show the remote tracking
38 branches in the repository:
39
40 % git branch -a
41 * blead
42 origin/HEAD
43 origin/blead
44 ...
45
46 The branches that begin with "origin" correspond to the "git remote"
47 that you cloned from (which is named "origin"). Each branch on the
48 remote will be exactly tracked by these branches. You should NEVER do
49 work on these remote tracking branches. You only ever do work in a
50 local branch. Local branches can be configured to automerge (on pull)
51 from a designated remote tracking branch. This is the case with the
52 default branch "blead" which will be configured to merge from the
53 remote tracking branch "origin/blead".
54
55 You can see recent commits:
56
57 % git log
58
59 And pull new changes from the repository, and update your local
60 repository (must be clean first)
61
62 % git pull
63
64 Assuming we are on the branch "blead" immediately after a pull, this
65 command would be more or less equivalent to:
66
67 % git fetch
68 % git merge origin/blead
69
70 In fact if you want to update your local repository without touching
71 your working directory you do:
72
73 % git fetch
74
75 And if you want to update your remote-tracking branches for all defined
76 remotes simultaneously you can do
77
78 % git remote update
79
80 Neither of these last two commands will update your working directory,
81 however both will update the remote-tracking branches in your
82 repository.
83
84 To make a local branch of a remote branch:
85
86 % git checkout -b maint-5.10 origin/maint-5.10
87
88 To switch back to blead:
89
90 % git checkout blead
91
92 Finding out your status
93 The most common git command you will use will probably be
94
95 % git status
96
97 This command will produce as output a description of the current state
98 of the repository, including modified files and unignored untracked
99 files, and in addition it will show things like what files have been
100 staged for the next commit, and usually some useful information about
101 how to change things. For instance the following:
102
103 % git status
104 On branch blead
105 Your branch is ahead of 'origin/blead' by 1 commit.
106
107 Changes to be committed:
108 (use "git reset HEAD <file>..." to unstage)
109
110 modified: pod/perlgit.pod
111
112 Changes not staged for commit:
113 (use "git add <file>..." to update what will be committed)
114 (use "git checkout -- <file>..." to discard changes in working
115 directory)
116
117 modified: pod/perlgit.pod
118
119 Untracked files:
120 (use "git add <file>..." to include in what will be committed)
121
122 deliberate.untracked
123
124 This shows that there were changes to this document staged for commit,
125 and that there were further changes in the working directory not yet
126 staged. It also shows that there was an untracked file in the working
127 directory, and as you can see shows how to change all of this. It also
128 shows that there is one commit on the working branch "blead" which has
129 not been pushed to the "origin" remote yet. NOTE: This output is also
130 what you see as a template if you do not provide a message to "git
131 commit".
132
133 Patch workflow
134 First, please read perlhack for details on hacking the Perl core. That
135 document covers many details on how to create a good patch.
136
137 If you already have a Perl repository, you should ensure that you're on
138 the blead branch, and your repository is up to date:
139
140 % git checkout blead
141 % git pull
142
143 It's preferable to patch against the latest blead version, since this
144 is where new development occurs for all changes other than critical bug
145 fixes. Critical bug fix patches should be made against the relevant
146 maint branches, or should be submitted with a note indicating all the
147 branches where the fix should be applied.
148
149 Now that we have everything up to date, we need to create a temporary
150 new branch for these changes and switch into it:
151
152 % git checkout -b orange
153
154 which is the short form of
155
156 % git branch orange
157 % git checkout orange
158
159 Creating a topic branch makes it easier for the maintainers to rebase
160 or merge back into the master blead for a more linear history. If you
161 don't work on a topic branch the maintainer has to manually cherry pick
162 your changes onto blead before they can be applied.
163
164 That'll get you scolded on perl5-porters, so don't do that. Be Awesome.
165
166 Then make your changes. For example, if Leon Brocard changes his name
167 to Orange Brocard, we should change his name in the AUTHORS file:
168
169 % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS
170
171 You can see what files are changed:
172
173 % git status
174 On branch orange
175 Changes to be committed:
176 (use "git reset HEAD <file>..." to unstage)
177
178 modified: AUTHORS
179
180 And you can see the changes:
181
182 % git diff
183 diff --git a/AUTHORS b/AUTHORS
184 index 293dd70..722c93e 100644
185 --- a/AUTHORS
186 +++ b/AUTHORS
187 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
188 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
189 Leif Huhn <leif@hale.dkstat.com>
190 Len Johnson <lenjay@ibm.net>
191 -Leon Brocard <acme@astray.com>
192 +Orange Brocard <acme@astray.com>
193 Les Peters <lpeters@aol.net>
194 Lesley Binks <lesley.binks@gmail.com>
195 Lincoln D. Stein <lstein@cshl.org>
196
197 Now commit your change locally:
198
199 % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
200 Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
201 1 files changed, 1 insertions(+), 1 deletions(-)
202
203 The "-a" option is used to include all files that git tracks that you
204 have changed. If at this time, you only want to commit some of the
205 files you have worked on, you can omit the "-a" and use the command
206 "git add FILE ..." before doing the commit. "git add --interactive"
207 allows you to even just commit portions of files instead of all the
208 changes in them.
209
210 The "-m" option is used to specify the commit message. If you omit it,
211 git will open a text editor for you to compose the message
212 interactively. This is useful when the changes are more complex than
213 the sample given here, and, depending on the editor, to know that the
214 first line of the commit message doesn't exceed the 50 character legal
215 maximum. See "Commit message" in perlhack for more information about
216 what makes a good commit message.
217
218 Once you've finished writing your commit message and exited your
219 editor, git will write your change to disk and tell you something like
220 this:
221
222 Created commit daf8e63: explain git status and stuff about remotes
223 1 files changed, 83 insertions(+), 3 deletions(-)
224
225 If you re-run "git status", you should see something like this:
226
227 % git status
228 On branch orange
229 Untracked files:
230 (use "git add <file>..." to include in what will be committed)
231
232 deliberate.untracked
233
234 nothing added to commit but untracked files present (use "git add" to
235 track)
236
237 When in doubt, before you do anything else, check your status and read
238 it carefully, many questions are answered directly by the git status
239 output.
240
241 You can examine your last commit with:
242
243 % git show HEAD
244
245 and if you are not happy with either the description or the patch
246 itself you can fix it up by editing the files once more and then issue:
247
248 % git commit -a --amend
249
250 Now, create a fork on GitHub to push your branch to, and add it as a
251 remote if you haven't already, as described in the GitHub documentation
252 at <https://help.github.com/en/articles/working-with-forks>:
253
254 % git remote add fork git@github.com:MyUser/perl5.git
255
256 And push the branch to your fork:
257
258 % git push -u fork orange
259
260 You should now submit a Pull Request (PR) on GitHub from the new branch
261 to blead. For more information, see the GitHub documentation at
262 <https://help.github.com/en/articles/creating-a-pull-request-from-a-fork>.
263
264 You can also send patch files to perl5-porters@perl.org
265 <mailto:perl5-porters@perl.org> directly if the patch is not ready to
266 be applied, but intended for discussion.
267
268 To create a patch file for all your local changes:
269
270 % git format-patch -M blead..
271 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
272
273 Or for a lot of changes, e.g. from a topic branch:
274
275 % git format-patch --stdout -M blead.. > topic-branch-changes.patch
276
277 If you want to delete your temporary branch, you may do so with:
278
279 % git checkout blead
280 % git branch -d orange
281 error: The branch 'orange' is not an ancestor of your current HEAD.
282 If you are sure you want to delete it, run 'git branch -D orange'.
283 % git branch -D orange
284 Deleted branch orange.
285
286 A note on derived files
287 Be aware that many files in the distribution are derivative--avoid
288 patching them, because git won't see the changes to them, and the build
289 process will overwrite them. Patch the originals instead. Most
290 utilities (like perldoc) are in this category, i.e. patch
291 utils/perldoc.PL rather than utils/perldoc. Similarly, don't create
292 patches for files under $src_root/ext from their copies found in
293 $install_root/lib. If you are unsure about the proper location of a
294 file that may have gotten copied while building the source
295 distribution, consult the MANIFEST.
296
297 Cleaning a working directory
298 The command "git clean" can with varying arguments be used as a
299 replacement for "make clean".
300
301 To reset your working directory to a pristine condition you can do:
302
303 % git clean -dxf
304
305 However, be aware this will delete ALL untracked content. You can use
306
307 % git clean -Xf
308
309 to remove all ignored untracked files, such as build and test
310 byproduct, but leave any manually created files alone.
311
312 If you only want to cancel some uncommitted edits, you can use "git
313 checkout" and give it a list of files to be reverted, or "git checkout
314 -f" to revert them all.
315
316 If you want to cancel one or several commits, you can use "git reset".
317
318 Bisecting
319 "git" provides a built-in way to determine which commit should be
320 blamed for introducing a given bug. "git bisect" performs a binary
321 search of history to locate the first failing commit. It is fast,
322 powerful and flexible, but requires some setup and to automate the
323 process an auxiliary shell script is needed.
324
325 The core provides a wrapper program, Porting/bisect.pl, which attempts
326 to simplify as much as possible, making bisecting as simple as running
327 a Perl one-liner. For example, if you want to know when this became an
328 error:
329
330 perl -e 'my $a := 2'
331
332 you simply run this:
333
334 .../Porting/bisect.pl -e 'my $a := 2;'
335
336 Using Porting/bisect.pl, with one command (and no other files) it's
337 easy to find out
338
339 · Which commit caused this example code to break?
340
341 · Which commit caused this example code to start working?
342
343 · Which commit added the first file to match this regex?
344
345 · Which commit removed the last file to match this regex?
346
347 usually without needing to know which versions of perl to use as start
348 and end revisions, as Porting/bisect.pl automatically searches to find
349 the earliest stable version for which the test case passes. Run
350 "Porting/bisect.pl --help" for the full documentation, including how to
351 set the "Configure" and build time options.
352
353 If you require more flexibility than Porting/bisect.pl has to offer,
354 you'll need to run "git bisect" yourself. It's most useful to use "git
355 bisect run" to automate the building and testing of perl revisions. For
356 this you'll need a shell script for "git" to call to test a particular
357 revision. An example script is Porting/bisect-example.sh, which you
358 should copy outside of the repository, as the bisect process will reset
359 the state to a clean checkout as it runs. The instructions below assume
360 that you copied it as ~/run and then edited it as appropriate.
361
362 You first enter in bisect mode with:
363
364 % git bisect start
365
366 For example, if the bug is present on "HEAD" but wasn't in 5.10.0,
367 "git" will learn about this when you enter:
368
369 % git bisect bad
370 % git bisect good perl-5.10.0
371 Bisecting: 853 revisions left to test after this
372
373 This results in checking out the median commit between "HEAD" and
374 "perl-5.10.0". You can then run the bisecting process with:
375
376 % git bisect run ~/run
377
378 When the first bad commit is isolated, "git bisect" will tell you so:
379
380 ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
381 commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
382 Author: Dave Mitchell <davem@fdisolutions.com>
383 Date: Sat Feb 9 14:56:23 2008 +0000
384
385 [perl #49472] Attributes + Unknown Error
386 ...
387
388 bisect run success
389
390 You can peek into the bisecting process with "git bisect log" and "git
391 bisect visualize". "git bisect reset" will get you out of bisect mode.
392
393 Please note that the first "good" state must be an ancestor of the
394 first "bad" state. If you want to search for the commit that solved
395 some bug, you have to negate your test case (i.e. exit with 1 if OK and
396 0 if not) and still mark the lower bound as "good" and the upper as
397 "bad". The "first bad commit" has then to be understood as the "first
398 commit where the bug is solved".
399
400 "git help bisect" has much more information on how you can tweak your
401 binary searches.
402
403 Following bisection you may wish to configure, build and test perl at
404 commits identified by the bisection process. Sometimes, particularly
405 with older perls, "make" may fail during this process. In this case
406 you may be able to patch the source code at the older commit point. To
407 do so, please follow the suggestions provided in "Building perl at
408 older commits" in perlhack.
409
410 Topic branches and rewriting history
411 Individual committers should create topic branches under
412 yourname/some_descriptive_name:
413
414 % branch="$yourname/$some_descriptive_name"
415 % git checkout -b $branch
416 ... do local edits, commits etc ...
417 % git push origin -u $branch
418
419 Should you be stuck with an ancient version of git (prior to 1.7), then
420 "git push" will not have the "-u" switch, and you have to replace the
421 last step with the following sequence:
422
423 % git push origin $branch:refs/heads/$branch
424 % git config branch.$branch.remote origin
425 % git config branch.$branch.merge refs/heads/$branch
426
427 If you want to make changes to someone else's topic branch, you should
428 check with its creator before making any change to it.
429
430 You might sometimes find that the original author has edited the
431 branch's history. There are lots of good reasons for this. Sometimes,
432 an author might simply be rebasing the branch onto a newer source
433 point. Sometimes, an author might have found an error in an early
434 commit which they wanted to fix before merging the branch to blead.
435
436 Currently the master repository is configured to forbid non-fast-
437 forward merges. This means that the branches within can not be rebased
438 and pushed as a single step.
439
440 The only way you will ever be allowed to rebase or modify the history
441 of a pushed branch is to delete it and push it as a new branch under
442 the same name. Please think carefully about doing this. It may be
443 better to sequentially rename your branches so that it is easier for
444 others working with you to cherry-pick their local changes onto the new
445 version. (XXX: needs explanation).
446
447 If you want to rebase a personal topic branch, you will have to delete
448 your existing topic branch and push as a new version of it. You can do
449 this via the following formula (see the explanation about "refspec"'s
450 in the git push documentation for details) after you have rebased your
451 branch:
452
453 # first rebase
454 % git checkout $user/$topic
455 % git fetch
456 % git rebase origin/blead
457
458 # then "delete-and-push"
459 % git push origin :$user/$topic
460 % git push origin $user/$topic
461
462 NOTE: it is forbidden at the repository level to delete any of the
463 "primary" branches. That is any branch matching
464 "m!^(blead|maint|perl)!". Any attempt to do so will result in git
465 producing an error like this:
466
467 % git push origin :blead
468 *** It is forbidden to delete blead/maint branches in this repository
469 error: hooks/update exited with error code 1
470 error: hook declined to update refs/heads/blead
471 To ssh://perl5.git.perl.org/perl
472 ! [remote rejected] blead (hook declined)
473 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
474
475 As a matter of policy we do not edit the history of the blead and
476 maint-* branches. If a typo (or worse) sneaks into a commit to blead or
477 maint-*, we'll fix it in another commit. The only types of updates
478 allowed on these branches are "fast-forwards", where all history is
479 preserved.
480
481 Annotated tags in the canonical perl.git repository will never be
482 deleted or modified. Think long and hard about whether you want to push
483 a local tag to perl.git before doing so. (Pushing simple tags is not
484 allowed.)
485
486 Grafts
487 The perl history contains one mistake which was not caught in the
488 conversion: a merge was recorded in the history between blead and
489 maint-5.10 where no merge actually occurred. Due to the nature of git,
490 this is now impossible to fix in the public repository. You can remove
491 this mis-merge locally by adding the following line to your
492 ".git/info/grafts" file:
493
494 296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
495
496 It is particularly important to have this graft line if any bisecting
497 is done in the area of the "merge" in question.
498
500 Once you have write access, you will need to modify the URL for the
501 origin remote to enable pushing. Edit .git/config with the
502 git-config(1) command:
503
504 % git config remote.origin.url git@github.com:Perl/perl5.git
505
506 You can also set up your user name and e-mail address. Most people do
507 this once globally in their ~/.gitconfig by doing something like:
508
509 % git config --global user.name "AEvar Arnfjoerd` Bjarmason"
510 % git config --global user.email avarab@gmail.com
511
512 However, if you'd like to override that just for perl, execute
513 something like the following in perl:
514
515 % git config user.email avar@cpan.org
516
517 It is also possible to keep "origin" as a git remote, and add a new
518 remote for ssh access:
519
520 % git remote add camel git@github.com:Perl/perl5.git
521
522 This allows you to update your local repository by pulling from
523 "origin", which is faster and doesn't require you to authenticate, and
524 to push your changes back with the "camel" remote:
525
526 % git fetch camel
527 % git push camel
528
529 The "fetch" command just updates the "camel" refs, as the objects
530 themselves should have been fetched when pulling from "origin".
531
532 Accepting a patch
533 If you have received a patch file generated using the above section,
534 you should try out the patch.
535
536 First we need to create a temporary new branch for these changes and
537 switch into it:
538
539 % git checkout -b experimental
540
541 Patches that were formatted by "git format-patch" are applied with "git
542 am":
543
544 % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
545 Applying Rename Leon Brocard to Orange Brocard
546
547 Note that some UNIX mail systems can mess with text attachments
548 containing 'From '. This will fix them up:
549
550 % perl -pi -e's/^>From /From /' \
551 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
552
553 If just a raw diff is provided, it is also possible use this two-step
554 process:
555
556 % git apply bugfix.diff
557 % git commit -a -m "Some fixing" \
558 --author="That Guy <that.guy@internets.com>"
559
560 Now we can inspect the change:
561
562 % git show HEAD
563 commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
564 Author: Leon Brocard <acme@astray.com>
565 Date: Fri Dec 19 17:02:59 2008 +0000
566
567 Rename Leon Brocard to Orange Brocard
568
569 diff --git a/AUTHORS b/AUTHORS
570 index 293dd70..722c93e 100644
571 --- a/AUTHORS
572 +++ b/AUTHORS
573 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
574 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
575 Leif Huhn <leif@hale.dkstat.com>
576 Len Johnson <lenjay@ibm.net>
577 -Leon Brocard <acme@astray.com>
578 +Orange Brocard <acme@astray.com>
579 Les Peters <lpeters@aol.net>
580 Lesley Binks <lesley.binks@gmail.com>
581 Lincoln D. Stein <lstein@cshl.org>
582
583 If you are a committer to Perl and you think the patch is good, you can
584 then merge it into blead then push it out to the main repository:
585
586 % git checkout blead
587 % git merge experimental
588 % git push origin blead
589
590 If you want to delete your temporary branch, you may do so with:
591
592 % git checkout blead
593 % git branch -d experimental
594 error: The branch 'experimental' is not an ancestor of your current
595 HEAD. If you are sure you want to delete it, run 'git branch -D
596 experimental'.
597 % git branch -D experimental
598 Deleted branch experimental.
599
600 Committing to blead
601 The 'blead' branch will become the next production release of Perl.
602
603 Before pushing any local change to blead, it's incredibly important
604 that you do a few things, lest other committers come after you with
605 pitchforks and torches:
606
607 · Make sure you have a good commit message. See "Commit message" in
608 perlhack for details.
609
610 · Run the test suite. You might not think that one typo fix would
611 break a test file. You'd be wrong. Here's an example of where not
612 running the suite caused problems. A patch was submitted that added
613 a couple of tests to an existing .t. It couldn't possibly affect
614 anything else, so no need to test beyond the single affected .t,
615 right? But, the submitter's email address had changed since the
616 last of their submissions, and this caused other tests to fail.
617 Running the test target given in the next item would have caught
618 this problem.
619
620 · If you don't run the full test suite, at least "make test_porting".
621 This will run basic sanity checks. To see which sanity checks, have
622 a look in t/porting.
623
624 · If you make any changes that affect miniperl or core routines that
625 have different code paths for miniperl, be sure to run "make
626 minitest". This will catch problems that even the full test suite
627 will not catch because it runs a subset of tests under miniperl
628 rather than perl.
629
630 On merging and rebasing
631 Simple, one-off commits pushed to the 'blead' branch should be simple
632 commits that apply cleanly. In other words, you should make sure your
633 work is committed against the current position of blead, so that you
634 can push back to the master repository without merging.
635
636 Sometimes, blead will move while you're building or testing your
637 changes. When this happens, your push will be rejected with a message
638 like this:
639
640 To ssh://perl5.git.perl.org/perl.git
641 ! [rejected] blead -> blead (non-fast-forward)
642 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl.git'
643 To prevent you from losing history, non-fast-forward updates were
644 rejected Merge the remote changes (e.g. 'git pull') before pushing
645 again. See the 'Note about fast-forwards' section of 'git push --help'
646 for details.
647
648 When this happens, you can just rebase your work against the new
649 position of blead, like this (assuming your remote for the master
650 repository is "p5p"):
651
652 % git fetch p5p
653 % git rebase p5p/blead
654
655 You will see your commits being re-applied, and you will then be able
656 to push safely. More information about rebasing can be found in the
657 documentation for the git-rebase(1) command.
658
659 For larger sets of commits that only make sense together, or that would
660 benefit from a summary of the set's purpose, you should use a merge
661 commit. You should perform your work on a topic branch, which you
662 should regularly rebase against blead to ensure that your code is not
663 broken by blead moving. When you have finished your work, please
664 perform a final rebase and test. Linear history is something that gets
665 lost with every commit on blead, but a final rebase makes the history
666 linear again, making it easier for future maintainers to see what has
667 happened. Rebase as follows (assuming your work was on the branch
668 "committer/somework"):
669
670 % git checkout committer/somework
671 % git rebase blead
672
673 Then you can merge it into master like this:
674
675 % git checkout blead
676 % git merge --no-ff --no-commit committer/somework
677 % git commit -a
678
679 The switches above deserve explanation. "--no-ff" indicates that even
680 if all your work can be applied linearly against blead, a merge commit
681 should still be prepared. This ensures that all your work will be
682 shown as a side branch, with all its commits merged into the mainstream
683 blead by the merge commit.
684
685 "--no-commit" means that the merge commit will be prepared but not
686 committed. The commit is then actually performed when you run the next
687 command, which will bring up your editor to describe the commit.
688 Without "--no-commit", the commit would be made with nearly no useful
689 message, which would greatly diminish the value of the merge commit as
690 a placeholder for the work's description.
691
692 When describing the merge commit, explain the purpose of the branch,
693 and keep in mind that this description will probably be used by the
694 eventual release engineer when reviewing the next perldelta document.
695
696 Committing to maintenance versions
697 Maintenance versions should only be altered to add critical bug fixes,
698 see perlpolicy.
699
700 To commit to a maintenance version of perl, you need to create a local
701 tracking branch:
702
703 % git checkout --track -b maint-5.005 origin/maint-5.005
704
705 This creates a local branch named "maint-5.005", which tracks the
706 remote branch "origin/maint-5.005". Then you can pull, commit, merge
707 and push as before.
708
709 You can also cherry-pick commits from blead and another branch, by
710 using the "git cherry-pick" command. It is recommended to use the -x
711 option to "git cherry-pick" in order to record the SHA1 of the original
712 commit in the new commit message.
713
714 Before pushing any change to a maint version, make sure you've
715 satisfied the steps in "Committing to blead" above.
716
717 Using a smoke-me branch to test changes
718 Sometimes a change affects code paths which you cannot test on the OSes
719 which are directly available to you and it would be wise to have users
720 on other OSes test the change before you commit it to blead.
721
722 Fortunately, there is a way to get your change smoke-tested on various
723 OSes: push it to a "smoke-me" branch and wait for certain automated
724 smoke-testers to report the results from their OSes. A "smoke-me"
725 branch is identified by the branch name: specifically, as seen on
726 github.com it must be a local branch whose first name component is
727 precisely "smoke-me".
728
729 The procedure for doing this is roughly as follows (using the example
730 of tonyc's smoke-me branch called win32stat):
731
732 First, make a local branch and switch to it:
733
734 % git checkout -b win32stat
735
736 Make some changes, build perl and test your changes, then commit them
737 to your local branch. Then push your local branch to a remote smoke-me
738 branch:
739
740 % git push origin win32stat:smoke-me/tonyc/win32stat
741
742 Now you can switch back to blead locally:
743
744 % git checkout blead
745
746 and continue working on other things while you wait a day or two,
747 keeping an eye on the results reported for your smoke-me branch at
748 <http://perl.develop-help.com/?b=smoke-me/tonyc/win32state>.
749
750 If all is well then update your blead branch:
751
752 % git pull
753
754 then checkout your smoke-me branch once more and rebase it on blead:
755
756 % git rebase blead win32stat
757
758 Now switch back to blead and merge your smoke-me branch into it:
759
760 % git checkout blead
761 % git merge win32stat
762
763 As described earlier, if there are many changes on your smoke-me branch
764 then you should prepare a merge commit in which to give an overview of
765 those changes by using the following command instead of the last
766 command above:
767
768 % git merge win32stat --no-ff --no-commit
769
770 You should now build perl and test your (merged) changes one last time
771 (ideally run the whole test suite, but failing that at least run the
772 t/porting/*.t tests) before pushing your changes as usual:
773
774 % git push origin blead
775
776 Finally, you should then delete the remote smoke-me branch:
777
778 % git push origin :smoke-me/tonyc/win32stat
779
780 (which is likely to produce a warning like this, which can be ignored:
781
782 remote: fatal: ambiguous argument
783 'refs/heads/smoke-me/tonyc/win32stat':
784 unknown revision or path not in the working tree.
785 remote: Use '--' to separate paths from revisions
786
787 ) and then delete your local branch:
788
789 % git branch -d win32stat
790
791
792
793perl v5.32.1 2021-03-31 PERLGIT(1)