Skip to content

Commit e06c02d

Browse files
committed
Merge branch 'progit:master' into patch-1
2 parents 8247a30 + 05d3306 commit e06c02d

File tree

17 files changed

+182
-71
lines changed

17 files changed

+182
-71
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ assignees: ''
1313
<!-- * This bug is about the Pro Git book, version 2, English language. -->
1414
<!-- * This bug is about the book as found on the [website](https://www.git-scm.com/book/en/v2) or the pdf. -->
1515
<!-- * If you found an issue in the pdf/epub/mobi files, you've checked if the problem is also present in the Pro Git book on the [website](https://www.git-scm.com/book/en/v2). -->
16-
<!-- * This bug is **not** about a translation, if so please file a bug with the translation project. You can find a table of translation projects here: [progit2/TRANSLATING.md](https://github.com/progit/progit2/blob/master/TRANSLATING.md) -->
17-
<!-- * This bug is **not** about the git-scm.com site, if so please file a bug here: [git-scm.com/issues/new](https://github.com/git/git-scm.com/issues/new) -->
18-
<!-- * This bug is **not** about git the program itself, if so please file a bug here: [git-scm.com/community](https://git-scm.com/community) -->
19-
<!-- * This bug is **not** about Git for Windows, if so please file a bug here: [git-for-windows/git](https://github.com/git-for-windows/git). -->
2016

2117
**Which version of the book is affected?**
2218
<!-- It's important for us to know if the problem is in the source or in the tooling for the pdf/epub/mobi files. -->

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
contact_links:
2+
- name: Translation bug
3+
url: https://github.com/progit/progit2/blob/master/TRANSLATING.md
4+
about: Refer to this table to find out where to report translation bugs.
5+
6+
- name: Report bugs for git-scm.com site
7+
url: https://github.com/git/git-scm.com/issues/
8+
about: Please report problems with the git-scm.com site here.
9+
10+
- name: Bug is about Git program itself
11+
url: https://git-scm.com/community
12+
about: Please report problems with the Git program here.
13+
14+
- name: Bug is about Git for Windows
15+
url: https://github.com/git-for-windows/git/issues
16+
about: Please report problems with Git for Windows here.

Gemfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
source 'https://rubygems.org'
22

3-
gem 'rake', ' 13.0.1'
4-
gem 'asciidoctor', '2.0.12'
3+
gem 'rake', '13.0.3'
4+
gem 'asciidoctor', '2.0.15'
55

6-
gem 'json', '2.4.1'
7-
gem 'awesome_print', '1.8.0'
6+
gem 'json', '2.5.1'
7+
gem 'awesome_print', '1.9.2'
88

99
gem 'asciidoctor-epub3', '1.5.0.alpha.19'
10-
gem 'asciidoctor-pdf', '1.5.3'
10+
gem 'asciidoctor-pdf', '1.5.4'
1111

1212
gem 'coderay', '1.1.3'
13-
gem 'pygments.rb', '1.2.1'
13+
gem 'pygments.rb', '2.2.0'
1414
gem 'thread_safe', '0.3.6'
15-
gem 'epubcheck-ruby', '4.2.4.0'
16-
gem 'html-proofer', '3.18.2'
15+
gem 'epubcheck-ruby', '4.2.5.0'
16+
gem 'html-proofer', '3.19.0'

README.asc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@ Converting to PDF...
2929
-- PDF output at progit.pdf
3030
----
3131

32+
You can generate just one of the supported formats (HTML, EPUB, or PDF).
33+
Use one of the following commands:
34+
35+
To generate the HTML book:
36+
37+
----
38+
$ bundle exec rake book:build_html
39+
----
40+
41+
To generate the EPUB book:
42+
43+
----
44+
$ bundle exec rake book:build_epub
45+
----
46+
47+
To generate the PDF book:
48+
49+
----
50+
$ bundle exec rake book:build_pdf
51+
----
52+
3253
== Signaling an Issue
3354

3455
Before signaling an issue, please check that there isn't already a similar one in the bug tracking system.

Rakefile

Lines changed: 106 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,84 @@ namespace :book do
66
end
77
end
88

9-
desc 'build basic book formats'
10-
task :build do
9+
# Variables referenced for build
10+
version_string = ENV['TRAVIS_TAG'] || `git describe --tags`.chomp
11+
if version_string.empty?
12+
version_string = '0'
13+
end
14+
date_string = Time.now.strftime('%Y-%m-%d')
15+
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'"
16+
header_hash = `git rev-parse --short HEAD`.strip
1117

12-
begin
13-
version_string = ENV['TRAVIS_TAG'] || `git describe --tags`.chomp
14-
if version_string.empty?
15-
version_string = '0'
18+
# Check contributors list
19+
# This checks commit hash stored in the header of list against current HEAD
20+
def check_contrib
21+
if File.exist?('book/contributors.txt')
22+
current_head_hash = `git rev-parse --short HEAD`.strip
23+
header = `head -n 1 book/contributors.txt`.strip
24+
# Match regex, then coerce resulting array to string by join
25+
header_hash = header.scan(/[a-f0-9]{7,}/).join
26+
27+
if header_hash == current_head_hash
28+
puts "Hash on header of contributors list (#{header_hash}) matches the current HEAD (#{current_head_hash})"
29+
else
30+
puts "Hash on header of contributors list (#{header_hash}) does not match the current HEAD (#{current_head_hash}), refreshing"
31+
`rm book/contributors.txt`
32+
# Reenable and invoke task again
33+
Rake::Task['book/contributors.txt'].reenable
34+
Rake::Task['book/contributors.txt'].invoke
1635
end
17-
date_string = Time.now.strftime("%Y-%m-%d")
18-
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'"
19-
puts "Generating contributors list"
20-
`git shortlog -s | grep -v -E "(Straub|Chacon)" | cut -f 2- | column -c 120 > book/contributors.txt`
36+
end
37+
end
38+
39+
desc 'build basic book formats'
40+
task :build => [:build_html, :build_epub, :build_pdf] do
41+
begin
42+
# Run check
43+
Rake::Task['book:check'].invoke
2144

22-
puts "Converting to HTML..."
45+
# Rescue to ignore checking errors
46+
rescue => e
47+
puts e.message
48+
puts 'Error when checking books (ignored)'
49+
end
50+
end
51+
52+
desc 'build basic book formats (for ci)'
53+
task :ci => [:build_html, :build_epub, :build_pdf] do
54+
# Run check, but don't ignore any errors
55+
Rake::Task['book:check'].invoke
56+
end
57+
58+
desc 'generate contributors list'
59+
file 'book/contributors.txt' do
60+
puts 'Generating contributors list'
61+
`echo "Contributors as of #{header_hash}:\n" > book/contributors.txt`
62+
`git shortlog -s | grep -v -E "(Straub|Chacon|dependabot)" | cut -f 2- | column -c 120 >> book/contributors.txt`
63+
end
64+
65+
desc 'build HTML format'
66+
task :build_html => 'book/contributors.txt' do
67+
check_contrib()
68+
69+
puts 'Converting to HTML...'
2370
`bundle exec asciidoctor #{params} -a data-uri progit.asc`
24-
puts " -- HTML output at progit.html"
71+
puts ' -- HTML output at progit.html'
2572

26-
exec_or_raise('htmlproofer --check-html progit.html')
73+
end
74+
75+
desc 'build Epub format'
76+
task :build_epub => 'book/contributors.txt' do
77+
check_contrib()
2778

28-
puts "Converting to EPub..."
79+
puts 'Converting to EPub...'
2980
`bundle exec asciidoctor-epub3 #{params} progit.asc`
30-
puts " -- Epub output at progit.epub"
81+
puts ' -- Epub output at progit.epub'
3182

32-
exec_or_raise('epubcheck progit.epub')
83+
end
3384

85+
desc 'build Mobi format'
86+
task :build_mobi => 'book/contributors.txt' do
3487
# Commented out the .mobi file creation because the kindlegen dependency is not available.
3588
# For more information on this see: #1496.
3689
# This is a (hopefully) temporary fix until upstream asciidoctor-epub3 is fixed and we can offer .mobi files again.
@@ -39,12 +92,47 @@ namespace :book do
3992
# `bundle exec asciidoctor-epub3 #{params} -a ebook-format=kf8 progit.asc`
4093
# puts " -- Mobi output at progit.mobi"
4194

42-
puts "Converting to PDF... (this one takes a while)"
95+
# FIXME: If asciidoctor-epub3 supports Mobi again, uncomment these lines below
96+
puts "Converting to Mobi isn't supported yet."
97+
puts "For more information see issue #1496 at https://github.com/progit/progit2/issues/1496."
98+
exit(127)
99+
end
100+
101+
desc 'build PDF format'
102+
task :build_pdf => 'book/contributors.txt' do
103+
check_contrib()
104+
105+
puts 'Converting to PDF... (this one takes a while)'
43106
`bundle exec asciidoctor-pdf #{params} progit.asc 2>/dev/null`
44-
puts " -- PDF output at progit.pdf"
107+
puts ' -- PDF output at progit.pdf'
108+
end
109+
110+
desc 'Check generated books'
111+
task :check => [:build_html, :build_epub] do
112+
puts 'Checking generated books'
45113

114+
exec_or_raise('htmlproofer --check-html progit.html')
115+
exec_or_raise('epubcheck progit.epub')
116+
end
117+
118+
desc 'Clean all generated files'
119+
task :clean do
120+
begin
121+
puts 'Removing generated files'
122+
123+
FileList['book/contributors.txt', 'progit.html', 'progit.epub', 'progit.pdf'].each do |file|
124+
rm file
125+
126+
# Rescue if file not found
127+
rescue Errno::ENOENT => e
128+
begin
129+
puts e.message
130+
puts 'Error removing files (ignored)'
131+
end
132+
end
46133
end
47134
end
135+
48136
end
49137

50138
task :default => "book:build"

book/01-introduction/sections/about-version-control.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ However, this setup also has some serious downsides.
4444
The most obvious is the single point of failure that the centralized server represents.
4545
If that server goes down for an hour, then during that hour nobody can collaborate at all or save versioned changes to anything they're working on.
4646
If the hard disk the central database is on becomes corrupted, and proper backups haven't been kept, you lose absolutely everything -- the entire history of the project except whatever single snapshots people happen to have on their local machines.
47-
Local VCS systems suffer from this same problem -- whenever you have the entire history of the project in a single place, you risk losing everything.
47+
Local VCSs suffer from this same problem -- whenever you have the entire history of the project in a single place, you risk losing everything.
4848

4949
==== Distributed Version Control Systems
5050

book/01-introduction/sections/installing.asc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ A macOS Git installer is maintained and available for download at the Git websit
5151
.Git macOS Installer
5252
image::images/git-osx-installer.png[Git macOS installer]
5353

54-
You can also install it as part of the GitHub for macOS install.
55-
Their GUI Git tool has an option to install command line tools as well.
56-
You can download that tool from the GitHub for macOS website, at https://desktop.github.com[].
57-
5854
==== Installing on Windows
5955

6056
There are also a few ways to install Git on Windows.(((Windows, installing)))
@@ -65,12 +61,6 @@ Note that this is a project called Git for Windows, which is separate from Git i
6561
To get an automated installation you can use the https://chocolatey.org/packages/git[Git Chocolatey package].
6662
Note that the Chocolatey package is community maintained.
6763

68-
Another easy way to get Git installed is by installing GitHub Desktop.
69-
The installer includes a command line version of Git as well as the GUI.
70-
It also works well with PowerShell, and sets up solid credential caching and sane CRLF settings.(((PowerShell)))(((CRLF)))(((credential caching)))
71-
We'll learn more about those things a little later, but suffice it to say they're things you want.
72-
You can download this from the https://desktop.github.com[GitHub Desktop website].
73-
7464
==== Installing from Source
7565

7666
Some people may instead find it useful to install Git from source, because you'll get the most recent version.

book/02-git-basics/sections/getting-a-repository.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ At this point, you have a Git repository with tracked files and an initial commi
5757
==== Cloning an Existing Repository
5858

5959
If you want to get a copy of an existing Git repository -- for example, a project you'd like to contribute to -- the command you need is `git clone`.
60-
If you're familiar with other VCS systems such as Subversion, you'll notice that the command is "clone" and not "checkout".
60+
If you're familiar with other VCSs such as Subversion, you'll notice that the command is "clone" and not "checkout".
6161
This is an important distinction -- instead of getting just a working copy, Git receives a full copy of nearly all data that the server has.
6262
Every version of every file for the history of the project is pulled down by default when you run `git clone`.
6363
In fact, if your server disk gets corrupted, you can often use nearly any of the clones on any client to set the server back to the state it was in when it was cloned (you may lose some server-side hooks and such, but all the versioned data would be there -- see <<ch04-git-on-the-server#_getting_git_on_a_server>> for more details).

book/02-git-basics/sections/recording-changes.asc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If you run this command directly after a clone, you should see something like th
2727
$ git status
2828
On branch master
2929
Your branch is up-to-date with 'origin/master'.
30-
nothing to commit, working directory clean
30+
nothing to commit, working tree clean
3131
----
3232

3333
This means you have a clean working directory; in other words, none of your tracked files are modified.
@@ -579,7 +579,7 @@ This command removes all files whose names end with a `~`.
579579
==== Moving Files
580580

581581
(((files, moving)))
582-
Unlike many other VCS systems, Git doesn't explicitly track file movement.
582+
Unlike many other VCSs, Git doesn't explicitly track file movement.
583583
If you rename a file in Git, no metadata is stored in Git that tells it you renamed the file.
584584
However, Git is pretty smart about figuring that out after the fact -- we'll deal with detecting file movement a bit later.
585585

book/02-git-basics/sections/remotes.asc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ $ git remote show origin
179179
----
180180

181181
It lists the URL for the remote repository as well as the tracking branch information.
182-
The command helpfully tells you that if you're on the `master` branch and you run `git pull`, it will automatically merge in the `master` branch on the remote after it fetches all the remote references.
182+
The command helpfully tells you that if you're on the `master` branch and you run `git pull`, it will automatically merge the remote's `master` branch into the local one after it has been fetched.
183183
It also lists all the remote references it has pulled down.
184184

185185
That is a simple example you're likely to encounter.

0 commit comments

Comments
 (0)