From owner-dev-commits-doc-all@freebsd.org Wed May 26 04:11:51 2021 Return-Path: Delivered-To: dev-commits-doc-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B32D3632AAF for ; Wed, 26 May 2021 04:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fqcw74dkLz3Q2c; Wed, 26 May 2021 04:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D6EF23CB; Wed, 26 May 2021 04:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14Q4BpAN036886; Wed, 26 May 2021 04:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14Q4BpMu036885; Wed, 26 May 2021 04:11:51 GMT (envelope-from git) Date: Wed, 26 May 2021 04:11:51 GMT Message-Id: <202105260411.14Q4BpMu036885@gitrepo.freebsd.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org From: Guangyuan Yang Subject: git: cb632051dc - main - porters-handbook: Fix the Git process in Chapter 11.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ygy X-Git-Repository: doc X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cb632051dc2b42ea8c8b92792867eba19a894905 Auto-Submitted: auto-generated X-BeenThere: dev-commits-doc-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the doc repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 May 2021 04:11:51 -0000 The branch main has been updated by ygy: URL: https://cgit.FreeBSD.org/doc/commit/?id=cb632051dc2b42ea8c8b92792867eba19a894905 commit cb632051dc2b42ea8c8b92792867eba19a894905 Author: Guangyuan Yang AuthorDate: 2021-05-26 04:08:47 +0000 Commit: Guangyuan Yang 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 Reviewed by: bcr, PauAmma 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]