Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 May 2021 04:11:51 GMT
From:      Guangyuan Yang <ygy@FreeBSD.org>
To:        doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org
Subject:   git: cb632051dc - main - porters-handbook: Fix the Git process in Chapter 11.1
Message-ID:  <202105260411.14Q4BpMu036885@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ygy:

URL: https://cgit.FreeBSD.org/doc/commit/?id=cb632051dc2b42ea8c8b92792867eba19a894905

commit cb632051dc2b42ea8c8b92792867eba19a894905
Author:     Guangyuan Yang <ygy@FreeBSD.org>
AuthorDate: 2021-05-26 04:08:47 +0000
Commit:     Guangyuan Yang <ygy@FreeBSD.org>
CommitDate: 2021-05-26 04:11:49 +0000

    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
---
 .../en/books/porters-handbook/upgrading/_index.adoc  | 20 +++++++++++++++-----
 1 file 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]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105260411.14Q4BpMu036885>