Skip to content

Commit

Permalink
Merge branch 'progit:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ousugo authored Dec 28, 2021
2 parents a62daac + 73d0e36 commit 0c9152a
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 41 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Pull Request Build

on:
pull_request:
branches: [ main, master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Download bootstrap file
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
- name: Run bootstrap
run: sh bootstrap.sh
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Build book
run: bundle exec rake book:build_action
42 changes: 42 additions & 0 deletions .github/workflows/release-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release on push to main

on:
push:
branches: [ main, master ]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: get bootstrap file
run: wget https://raw.githubusercontent.com/progit/progit2-pub/master/bootstrap.sh
- name: run bootstrap
run: sh bootstrap.sh
- name: Compute tag name
id: compute-tag
run: |
echo Computing next tag number
LASTPATCH=$(git describe --tags | cut -d- -f1 | cut -d. -f3)
PATCH=$(($LASTPATCH+1))
echo "::set-output name=tagname::2.1.${PATCH}"
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Build release assets
run: bundle exec rake book:build_action

- name: Create release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.compute-tag.outputs.tagname }}
commit: ${{ steps.compute-tag.outputs.branch }}
artifacts: './progit.epub,./progit.mobi,./progit.pdf,./progit.html'
2 changes: 1 addition & 1 deletion book/01-introduction/sections/first-time-setup.asc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -m
====
Vim、Emacs 和 Notepad++ 都是流行的文本编辑器,通常程序员们会在 Linux 和 macOS
这类基于 Unix 的系统或 Windows 系统上使用它们。
如果你在使用其他的或 32 版本的编辑器,请在 <<C-git-commands#_core_editor>>
如果你在使用其他的或 32 位版本的编辑器,请在 <<C-git-commands#_core_editor>>
中查看设置为该编辑器的具体步骤。
====

Expand Down
7 changes: 4 additions & 3 deletions book/02-git-basics/sections/recording-changes.asc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== 记录每次更新到仓库

现在我们的机器上有了一个 *真实项目* 的 Git 仓库,并从这个仓库中检出了所有文件的 *工作副本*
通常,你会对这些文件做些修改,每当完成了一个阶段的目标,想要将记录下它时,就将它提交到到仓库
通常,你会对这些文件做些修改,每当完成了一个阶段的目标,想要将记录下它时,就将它提交到仓库

请记住,你工作目录下的每一个文件都不外乎这两种状态:*已跟踪**未跟踪*
已跟踪的文件是指那些被纳入了版本控制的文件,在上一次快照中有它们的记录,在工作一段时间后,
Expand Down Expand Up @@ -626,5 +626,6 @@ $ git add README
----

如此分开操作,Git 也会意识到这是一次重命名,所以不管何种方式结果都一样。
两者唯一的区别是,`mv` 是一条命令而非三条命令,直接用 `git mv` 方便得多。
不过有时候用其他工具批处理重命名的话,要记得在提交前删除旧的文件名,再添加新的文件名。
两者唯一的区别在于,`git mv` 是一条命令而非三条命令,直接使用 `git mv` 方便得多。
不过在使用其他工具重命名文件时,记得在提交前 `git rm` 删除旧文件名,再 `git add`
添加新文件名。
2 changes: 1 addition & 1 deletion book/02-git-basics/sections/undoing.asc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ git commit --amend

[NOTE]
====
当你在修补最后的提交时,并不是通过用改进后的提交 *原位替换* 掉旧有提交的方式来修复的
当你在修补最后的提交时,与其说是修复旧提交,倒不如说是完全用一个 *新的提交* 替换旧的提交
理解这一点非常重要。从效果上来说,就像是旧有的提交从未存在过一样,它并不会出现在仓库的历史中。
修补提交最明显的价值是可以稍微改进你最后的提交,而不会让“啊,忘了添加一个文件”或者
Expand Down
6 changes: 3 additions & 3 deletions book/02-git-basics/sections/viewing-history.asc
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ $ git log --since=2.weeks

[NOTE]
====
你可以指定多个 `--author` 和 `--grep` 搜索条件,这样会只输出 *任意* 匹配
`--author` 模式和 `--grep` 模式的提交。然而,如果你添加了 `--all-match` 选项,
则只会输出 *所有* 匹配 `--grep` 模式的提交。
你可以指定多个 `--author` 和 `--grep` 搜索条件,这样会只输出匹配 *任意*
`--author` 模式和 *任意* `--grep` 模式的提交。然而,如果你添加了 `--all-match` 选项,
则只会输出匹配 *所有* `--grep` 模式的提交。
====

另一个非常有用的过滤器是 `-S`(俗称“pickaxe”选项,取“用鹤嘴锄在土里捡石头”之意),
Expand Down
2 changes: 1 addition & 1 deletion book/04-git-server/sections/gitlab.asc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ web 用户界面提供了几个有用的获取版本库信息的网页。
==== 一起工作

在一个 GitLab 项目上一起工作的最简单方法就是赋予协作者对 git 版本库的直接 push 权限。
你可以通过项目设定的 “Members(成员)” 部分向一个项目添加写作者
你可以通过项目设定的 “Members(成员)” 部分向一个项目添加协作者
并且将这个新的协作者与一个访问级别关联(不同的访问级别在 <<_gitlab_groups_section>> 中已简单讨论)。
通过赋予一个协作者 “Developer(开发者)” 或者更高的访问级别,
这个用户就可以毫无约束地直接向版本库或者向分支进行提交。
Expand Down
13 changes: 13 additions & 0 deletions book/10-git-internals/sections/transfer-protocols.asc
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ $ ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
这里的全为 '0' 的 SHA-1 值表示之前没有过这个引用——因为你正要添加新的 experiment 引用。
删除引用时,将会看到相反的情况:右边的 SHA-1 值全为 '0'。

然后,客户端会发送一个包含了所有服务端上所没有的对象的包文件。
最终,服务端会响应一个成功(或失败)的标识。

[source]
----
000eunpack ok
----

====== HTTP(S)

上传过程在 HTTP 上几乎是相同的,除了握手阶段有一点小区别。
连接是从下面这个请求开始的:

[source]
Expand All @@ -198,6 +209,8 @@ $ ssh -x git@server "git-receive-pack 'simplegit-progit.git'"
这个 `POST` 请求的内容是 `send-pack` 的输出和相应的包文件。
服务端在收到请求后相应地作出成功或失败的 HTTP 响应。

请牢记,HTTP 协议有可能会进一步用分块传输编码将数据包裹起来。

===== 下载数据

(((git commands, fetch-pack)))(((git commands, upload-pack)))
Expand Down
2 changes: 1 addition & 1 deletion book/A-git-in-other-environments/sections/powershell.asc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ image::images/posh-git.png[附带了 Posh-Git 扩展包的 Powershell]
===== PowerShell Gallery
如果你有 PowerShell 5 以上或安装了 PackageManagement 的 PowerShell 4,那么可以用包管理器来安装 posh-git。

有关 PowerShell Gallery 的更多详情: https://docs.microsoft.com/en-us/powershell/gallery/overview[]
有关 PowerShell Gallery 的更多详情: https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview[]
[source,powershell]
-----
> Install-Module posh-git -Scope CurrentUser -Force
Expand Down
4 changes: 2 additions & 2 deletions book/A-git-in-other-environments/sections/sublimetext.asc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* 在状态栏,你能够查看当前所在分支以及你做了多少修改。
* 对一个文件的所有改动都会通过行号槽上的记号显示出来。
* 你能够在 Sublime Text 内使用 Sublime Merge 这个 Git 客户端的部分功能。(要求安装 Sublime Merge:
https://www.sublimemerge.com/)
https://www.sublimemerge.com/
Sublime Text 的官方文档请访问:
https://www.sublimetext.com/docs/3/git_integration.html 。
https://www.sublimetext.com/docs/3/git_integration.html 。
11 changes: 5 additions & 6 deletions book/B-embedding-git/sections/dulwich.asc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Dulwich follows git design and separate two basic levels of API: plumbing and po
Here is an example of using the lower level API to access the commit message of the last commit:

[source, python]
-----
----
from dulwich.repo import Repo
r = Repo('.')
r.head()
Expand All @@ -23,22 +23,21 @@ c
c.message
# 'Add note about encoding.\n'
-----
----

To print a commit log using high-level porcelain API, one can use:

[source, python]
-----
----
from dulwich import porcelain
porcelain.log('.', max_entries=1)
#commit: 57fbe010446356833a6ad1600059d80b1e731e15
#Author: Jelmer Vernooij <[email protected]>
#Date: Sat Apr 29 2017 23:57:34 +0000
-----
----


==== Further Reading

* The official API documentation is available at https://www.dulwich.io/apidocs/dulwich.html[]
* Official tutorial at https://www.dulwich.io/docs/tutorial[] has many examples of how to do specific tasks with Dulwich
The API documentation, tutorial, and many examples of how to do specific tasks with Dulwich are available on the official website https://www.dulwich.io[].
5 changes: 2 additions & 3 deletions book/B-embedding-git/sections/jgit.asc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ for (Ref ref : remoteRefs) {
这只是 JGit 的全部能力的冰山一角。
如果你对这有兴趣并且想深入学习,在下面可以找到一些信息和灵感。

* JGit API 在线官方文档: http://download.eclipse.org/jgit/docs/latest/apidocs[] 。
这是基本的 Javadoc ,所以你也可以在你最喜欢的 JVM IDE 上将它们安装它们到本地。
* JGit API 在线官方文档: https://www.eclipse.org/jgit/documentation[] 。
这是基本的 Javadoc ,所以你也可以在你最喜欢的 JVM IDE 上将它们安装它们到本地。
* JGit Cookbook : https://github.com/centic9/jgit-cookbook[] 拥有许多如何利用 JGit 实现特定任务的例子。
* http://stackoverflow.com/questions/6861881[] 指出了几个好的资源。
Loading

0 comments on commit 0c9152a

Please sign in to comment.