[Dnsmasq-discuss] Submitting a patch, git commands

Geert Stappers stappers at stappers.nl
Sun May 21 14:49:08 UTC 2023


On Wed, May 03, 2023 at 07:17:57AM +0200, Geert Stappers wrote:
> On Wed, May 03, 2023 at 05:04:52AM +0800, Justin wrote:
> > https://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=blob;f=man/dnsmasq.8;h=30429dfa84457af04651269b785aa8a8141265de;hb=HEAD#l393
> > 
> > diff
> > a comma-separated list or RR-types
> > a comma-separated list of RR-types
> 
> At https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2023q2/017012.html
> an example how a patch should like. Generate it
> with git subcommands  `commit`, `format-patch` and `send-email`.

cd dnsmasq
git branch | grep \*
git pull
git pull
git branch typo_fix_N
git switch typo_fix_N 
$EDITOR man/dnsmasq.8 
git diff
$EDITOR man/dnsmasq.8 
git diff
git add man/dnsmasq.8 
git diff
git diff --cached
git status
git commit
git show
git commit --amend
git show
git format-patch master
git switch master 
git send-email 0001-*.patch
 
> It is OK to ask additional information about that process.
 
Below an example of submitting a patch.
Starting point is a git clone of dnsmasq
and that git repository is in directory named dnsmasq.


| stappers at alpaca:~/src
| $ cd dnsmasq
| stappers at alpaca:~/src/dnsmasq
| $ git branch | grep \*
| * master

OK, currently in the desired git branch.


| stappers at alpaca:~/src/dnsmasq
| $ git pull

Update request

| Updating aaba66e..1d6fe0e
| Fast-forward
|  CHANGELOG     |   8 ++++++++
|  src/dbus.c    |  43 +++++++++++++++++++++++++++--------------
|  src/edns0.c   |  17 +++++++----------
|  src/rfc3315.c |  36 +++++++++++++++++++++++++++++------
|  src/tftp.c    |   2 +-
|  6 files changed, 126 insertions(+), 82 deletions(-)
| stappers at alpaca:~/src/dnsmasq
| $ git pull

Update request

| Already up to date.

OK, up to date


| stappers at alpaca:~/src/dnsmasq
| $ git branch typo_fix_N

Create a new branch and branch should be name 'typo_fix_N'


| stappers at alpaca:~/src/dnsmasq
| $ git switch typo_fix_N 
| Switched to branch 'typo_fix_N'

Now in the branch where the work will happen.


| stappers at alpaca:~/src/dnsmasq
| $ $EDITOR man/dnsmasq.8 

The actual editting.


| stappers at alpaca:~/src/dnsmasq
| $ git diff

Show differences against what "git" has.


| diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
| index 30429df..d131bbe 100644
| --- a/man/dnsmasq.8
| +++ b/man/dnsmasq.8
| @@ -390,7 +390,7 @@ Remove records of the specified type(s) from answers.
|  By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.
|  This option adds other record types to the cache. The RR-type can be given
|  as a name such as TXT or MX or a decimal number. A single --cache-rr option
| -can take a comma-separated list or RR-types and more than one --cache-rr option
| +can take a comma-separated list off RR-types and more than one --cache-rr option
|  is allowed. Use --cache-rr=ANY to enable caching for all RR-types.
|  .TP
|  .B \-r, --resolv-file=<file>
| stappers at alpaca:~/src/dnsmasq
| $ $EDITOR man/dnsmasq.8 

Because further editting is needed.


| stappers at alpaca:~/src/dnsmasq
| $ git diff
| diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
| index 30429df..d131bbe 100644
| --- a/man/dnsmasq.8
| +++ b/man/dnsmasq.8
| @@ -390,7 +390,7 @@ Remove records of the specified type(s) from answers.
|  By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.
|  This option adds other record types to the cache. The RR-type can be given
|  as a name such as TXT or MX or a decimal number. A single --cache-rr option
| -can take a comma-separated list or RR-types and more than one --cache-rr option
| +can take a comma-separated list of RR-types and more than one --cache-rr option
|  is allowed. Use --cache-rr=ANY to enable caching for all RR-types.
|  .TP
|  .B \-r, --resolv-file=<file>

OK

| stappers at alpaca:~/src/dnsmasq
| $ git add man/dnsmasq.8 

Inform git which files should go
into the next commit.

| stappers at alpaca:~/src/dnsmasq
| $ git diff
| stappers at alpaca:~/src/dnsmasq

No output, which is expected.
We have made git aware of what is changed.

| stappers at alpaca:~/src/dnsmasq
| $ git diff --cached
| diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
| index 30429df..d131bbe 100644
| --- a/man/dnsmasq.8
| +++ b/man/dnsmasq.8
| @@ -390,7 +390,7 @@ Remove records of the specified type(s) from answers.
|  By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.
|  This option adds other record types to the cache. The RR-type can be given
|  as a name such as TXT or MX or a decimal number. A single --cache-rr option
| -can take a comma-separated list or RR-types and more than one --cache-rr option
| +can take a comma-separated list of RR-types and more than one --cache-rr option
|  is allowed. Use --cache-rr=ANY to enable caching for all RR-types.
|  .TP
|  .B \-r, --resolv-file=<file>

OK

| stappers at alpaca:~/src/dnsmasq
| $ git status

Asks for a report

| On branch typo_fix_N
| Changes to be committed:
|   (use "git restore --staged <file>..." to unstage)
| 	modified:   man/dnsmasq.8

Matches with what we want
 
| Untracked files:
|   (use "git add <file>..." to include in what will be committed)
| 	.clang-format
| 	0001-Have-it-buildable-runable.patch
| 	WIPclang-format
| 	fastreload.patch
| 	stappers_bouwt

Just files that "git" is not aware off.

 
| stappers at alpaca:~/src/dnsmasq
| $ git commit

Starts texteditor, so you can craft the commit message.

|  1 file changed, 1 insertion(+), 1 deletion(-)

Texteditor closed.

| stappers at alpaca:~/src/dnsmasq
| $ git show

To show latest commit

| commit 3f23be58d531c69268948f6880055db0f4b36293 (HEAD -> typo_fix_N)
| Author: Geert Stappers <stappers at stappers.nl>
| Date:   Wed May 17 19:38:29 2023 +0200
| 
|     Minor typo fix in the man page
|     
|     The manual page had "list or RR-typos",
|     changed it into "list of RR-typos".
     
Oops, typos in the commit message    :-)

|     Reported-by: Justin <cattyhouse at gmail.com>
| 
| diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
| index 30429df..d131bbe 100644
| --- a/man/dnsmasq.8
| +++ b/man/dnsmasq.8
| @@ -390,7 +390,7 @@ Remove records of the specified type(s) from answers.
|  By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.
|  This option adds other record types to the cache. The RR-type can be given
|  as a name such as TXT or MX or a decimal number. A single --cache-rr option
| -can take a comma-separated list or RR-types and more than one --cache-rr option
| +can take a comma-separated list of RR-types and more than one --cache-rr option
|  is allowed. Use --cache-rr=ANY to enable caching for all RR-types.
|  .TP
|  .B \-r, --resolv-file=<file>
| stappers at alpaca:~/src/dnsmasq
| $ git commit --amend

Editor is started for editing the commit message.

|  1 file changed, 1 insertion(+), 1 deletion(-)

Editor closed

| stappers at alpaca:~/src/dnsmasq
| $ git show
| commit 81f3e5401838867ae0e5d8204f917c7241d810e2 (HEAD -> typo_fix_N)
| Author: Geert Stappers <stappers at stappers.nl>
| Date:   Wed May 17 19:38:29 2023 +0200
| 
|     Minor typo fix in the man page
|     
|     The manual page had "list or RR-types",
|     changed it into "list of RR-types".
|     
|     Reported-by: Justin <cattyhouse at gmail.com>
| 
| diff --git a/man/dnsmasq.8 b/man/dnsmasq.8
| index 30429df..d131bbe 100644
| --- a/man/dnsmasq.8
| +++ b/man/dnsmasq.8
| @@ -390,7 +390,7 @@ Remove records of the specified type(s) from answers.
|  By default, dnsmasq caches A, AAAA, CNAME and SRV DNS record types.
|  This option adds other record types to the cache. The RR-type can be given
|  as a name such as TXT or MX or a decimal number. A single --cache-rr option
| -can take a comma-separated list or RR-types and more than one --cache-rr option
| +can take a comma-separated list of RR-types and more than one --cache-rr option
|  is allowed. Use --cache-rr=ANY to enable caching for all RR-types.
|  .TP
|  .B \-r, --resolv-file=<file>

Yes, thas is what we are aiming for.


| stappers at alpaca:~/src/dnsmasq
| $ git format-patch master

Create patches of where current git branch differs
with the git branch named master

| 0001-Minor-typo-fix-in-the-man-page.patch

The generate file. Content is like the `git show` output.
(Do `cat 0001-Minor-typo-fix-in-the-man-page.patch` to verify that.)

It is the 0001-Minor-typo-fix-in-the-man-page.patch should 
go to the mailinglist.

| stappers at alpaca:~/src/dnsmasq
| $ git switch master 
| Switched to branch 'master'

Because our work in the fix-typo-branch is finished.


| stappers at alpaca:~/src/dnsmasq
| $ git send-email 0001-Minor-typo-fix-in-the-man-page.patch

An attempt to share the patch with the mailinglist.


| 0001-Minor-typo-fix-in-the-man-page.patch
| (mbox) Adding cc: Geert Stappers <stappers at stappers.nl> from line 'From: Geert Stappers <stappers at stappers.nl>'
| (body) Adding cc: Justin <cattyhouse at gmail.com> from line 'Reported-by: Justin <cattyhouse at gmail.com>'
| 
| From: Geert Stappers <stappers at stappers.nl>
| To: Dnsmasq Mailinglist <dnsmasq-discuss at lists.thekelleys.org.uk>
| Cc: 'Geert Stappers ' <stappers at stappers.nl>,
| 	Justin <cattyhouse at gmail.com>
| Subject: [PATCH] Minor typo fix in the man page
| Date: Wed, 17 May 2023 19:48:40 +0200
| Message-Id: <20230517174840.31046-1-stappers at stappers.nl>
| X-Mailer: git-send-email 2.30.2
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| 
|     The Cc list above has been expanded by additional
|     addresses found in the patch commit message. By default
|     send-email prompts before sending whenever this occurs.
|     This behavior is controlled by the sendemail.confirm
|     configuration setting.
| 
|     For additional information, run 'git send-email --help'.
|     To retain the current behavior, but squelch this message,
|     run 'git config --global sendemail.confirm auto'.
| 
| Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): e

In the hope to add  "In Reply To" reference.


| (mbox) Adding cc: Geert Stappers <stappers at stappers.nl> from line 'From: Geert Stappers <stappers at stappers.nl>'
| (body) Adding cc: Justin <cattyhouse at gmail.com> from line 'Reported-by: Justin <cattyhouse at gmail.com>'
| 
| From: Geert Stappers <stappers at stappers.nl>
| To: Dnsmasq Mailinglist <dnsmasq-discuss at lists.thekelleys.org.uk>
| Cc: 'Geert Stappers ' <stappers at stappers.nl>,
| 	Justin <cattyhouse at gmail.com>
| Subject: [PATCH] Minor typo fix in the man page
| Date: Wed, 17 May 2023 19:48:41 +0200
| Message-Id: <20230517174840.31046-1-stappers at stappers.nl>
| X-Mailer: git-send-email 2.30.2
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| 
| Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): q

The '[e]dit' was not what I had in mind.

| stappers at alpaca:~/src/dnsmasq
| $ git send-email --in-reply-to='ZFHuhRIVPEBex/oq at gpm.stappers.nl' 0001-Minor-typo-fix-in-the-man-page.patch

New share attempt, this time with "In Reply To"


| 0001-Minor-typo-fix-in-the-man-page.patch
| (mbox) Adding cc: Geert Stappers <stappers at stappers.nl> from line 'From: Geert Stappers <stappers at stappers.nl>'
| (body) Adding cc: Justin <cattyhouse at gmail.com> from line 'Reported-by: Justin <cattyhouse at gmail.com>'
| 
| From: Geert Stappers <stappers at stappers.nl>
| To: Dnsmasq Mailinglist <dnsmasq-discuss at lists.thekelleys.org.uk>
| Cc: 'Geert Stappers ' <stappers at stappers.nl>,
| 	Justin <cattyhouse at gmail.com>
| Subject: [PATCH] Minor typo fix in the man page
| Date: Wed, 17 May 2023 19:51:34 +0200
| Message-Id: <20230517175134.31104-1-stappers at stappers.nl>
| X-Mailer: git-send-email 2.30.2
| In-Reply-To: <ZFHuhRIVPEBex/oq at gpm.stappers.nl>
| References: <ZFHuhRIVPEBex/oq at gpm.stappers.nl>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| 
|     The Cc list above has been expanded by additional
|     addresses found in the patch commit message. By default
|     send-email prompts before sending whenever this occurs.
|     This behavior is controlled by the sendemail.confirm
|     configuration setting.
| 
|     For additional information, run 'git send-email --help'.
|     To retain the current behavior, but squelch this message,
|     run 'git config --global sendemail.confirm auto'.
| 
| Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y
| OK. Log says:
| Server: hop.stappers.nl
| MAIL FROM:<stappers at stappers.nl>
| RCPT TO:<dnsmasq-discuss at lists.thekelleys.org.uk>
| RCPT TO:<stappers at stappers.nl>
| RCPT TO:<cattyhouse at gmail.com>
| From: Geert Stappers <stappers at stappers.nl>
| To: Dnsmasq Mailinglist <dnsmasq-discuss at lists.thekelleys.org.uk>
| Cc: 'Geert Stappers ' <stappers at stappers.nl>,
| 	Justin <cattyhouse at gmail.com>
| Subject: [PATCH] Minor typo fix in the man page
| Date: Wed, 17 May 2023 19:51:34 +0200
| Message-Id: <20230517175134.31104-1-stappers at stappers.nl>
| X-Mailer: git-send-email 2.30.2
| In-Reply-To: <ZFHuhRIVPEBex/oq at gpm.stappers.nl>
| References: <ZFHuhRIVPEBex/oq at gpm.stappers.nl>
| MIME-Version: 1.0
| Content-Transfer-Encoding: 8bit
| 
| Result: 250 

A.K.A.  Succes!   And the result
became https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2023q2/017095.html

| stappers at alpaca:~/src/dnsmasq
| $ git config --list

For showing what is configured at my machine.

The 'sendemail' entries are the interesting ones.


| user.email=stappers at stappers.nl
| core.repositoryformatversion=0
| core.filemode=true
| core.bare=false
| core.logallrefupdates=true
| user.name='Geert Stappers'
| user.email=stappers at stappers.nl
| sendemail.to=Dnsmasq Mailinglist <dnsmasq-discuss at lists.thekelleys.org.uk>
| sendemail.cc='Geert Stappers <stappers at stappers.nl>'
| sendemail.smtpserver=hop.stappers.nl
| remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
| remote.origin.url=git://thekelleys.org.uk/dnsmasq.git
| remote.salsa.url=https://stappers@salsa.debian.org/debian/dnsmasq.git
| remote.salsa.fetch=+refs/heads/*:refs/remotes/salsa/*
| branch.master.remote=origin
| branch.master.merge=refs/heads/master
| branch.salsa_master.remote=salsa
| branch.salsa_master.merge=refs/heads/master
| stappers at alpaca:~/src/dnsmasq
| $ cd ..

There is life outside dnsmasq   8^)

| stappers at alpaca:~/src
| $



More information about the Dnsmasq-discuss mailing list