aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuangyuan Yang <ygy@FreeBSD.org>2021-05-26 04:08:47 +0000
committerGuangyuan Yang <ygy@FreeBSD.org>2021-05-26 04:11:49 +0000
commitcb632051dc2b42ea8c8b92792867eba19a894905 (patch)
tree2b1c7656ca2bfe4a4bf7380cfa41795bc700bac0
parentd528c1bd0030a75f64b865b405a36b5ac5edb434 (diff)
downloaddoc-cb632051dc2b42ea8c8b92792867eba19a894905.tar.gz
doc-cb632051dc2b42ea8c8b92792867eba19a894905.zip
porters-handbook: Fix the Git process in Chapter 11.1
In Chapter 11.1 Using Git to Make Patches, there are multiple issues with the process: - `git pull --rebase` will refuse to work if there are any staged or unstaged changes, so the users are unable to update the repo to the latest. - `git diff` does not work for staged changes, need to add `--staged`. This commit attempts to address the above. PR: 256122 Reported by: Neal Nelson <ports@nicandneal.net> Reviewed by: bcr, PauAmma <pauamma@gundo.com> Differential Revision: https://reviews.freebsd.org/D30422
-rw-r--r--documentation/content/en/books/porters-handbook/upgrading/_index.adoc20
1 files changed, 15 insertions, 5 deletions
diff --git a/documentation/content/en/books/porters-handbook/upgrading/_index.adoc b/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
index 94e011f752..e1f39815f3 100644
--- a/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
+++ b/documentation/content/en/books/porters-handbook/upgrading/_index.adoc
@@ -90,7 +90,7 @@ When possible, please submit a man:git[1] diff. They are easier to handle than d
[source,shell]
....
% git clone https://git.FreeBSD.org/ports.git ~/my_wrkdir <.> <.>
-% cd ~/my_wrkdir/dns/pdnsd
+% cd ~/my_wrkdir
....
<.> This can be anywhere, of course. Building ports is not limited to within [.filename]#/usr/ports/#.
@@ -108,19 +108,29 @@ While in the port directory, make any changes that are needed. If adding, moving
Make sure to check the port using the checklist in crossref:quick-porting[porting-testing,Testing the Port] and crossref:quick-porting[porting-portlint,Checking the Port with `portlint`].
+Before making the patch, fetch the latest repository and rebase the changes on top of it.
+Watch and follow the output carefully.
+If any of the files failed to rebase, it means that the upstream files changed while you were editing the same file, and the conflicts need to be resolved manually.
+
[source,shell]
....
-% git status --short
-% git pull --rebase <.>
+% git fetch origin main
+% git rebase origin/main
....
-<.> This will attempt to merge the differences between the patch and current repository version. Watch the output carefully. The letter in front of each file name indicates what was done with it.
+Check the changes staged for the patch:
+
+[source,shell]
+....
+% git status
+% git diff --staged
+....
The last step is to make a unified man:diff[1] of the changes:
[source,shell]
....
-% git diff . > ../`make -VPKGNAME`.diff
+% git diff --staged > ../`make -VPKGNAME`.diff
....
[NOTE]