unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sarah Morgensen <iskarian@mgsn.dev>
To: 50363@debbugs.gnu.org
Cc: ludo@gnu.org, maximedevos@telenet.be, kyle@kyleam.com
Subject: [bug#50363] [PATCH v4] Improve default diff hunk header detection.
Date: Mon, 20 Sep 2021 16:37:44 -0700	[thread overview]
Message-ID: <bbac973c0d0388fabe126bd44b60b0683ffe9f03.1632180690.git.iskarian@mgsn.dev> (raw)
In-Reply-To: <e6e08312afa17ee812f8b538118bec6da86d3357.1630708121.git.iskarian@mgsn.dev>

Tell git where to look for diff hunk headers: top-level definitions for
Scheme files, and (sub)section headers for texi files.

* .gitattributes, etc/git/gitconfig: New files.
* doc/contributing.texi ("Submitting Patches"): Add subsection
"Configuring Git".  Document etc/git/gitconfig.
---
Changes since v3 (thanks to Kyle for the suggestions):

* Diff name changed from "tex" to "texinfo"

* "texinfo" diff matches nodes rather than sections (this is what most
texinfo diff drivers seem to do)

* Examples fixed

--
 .gitattributes        |  3 +++
 doc/contributing.texi | 46 +++++++++++++++++++++++++++++++++++++++----
 doc/guix.texi         |  1 +
 etc/git/gitconfig     |  5 +++++
 4 files changed, 51 insertions(+), 4 deletions(-)
 create mode 100644 .gitattributes
 create mode 100644 etc/git/gitconfig

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..b31f7fd74d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+*.scm       diff=scheme
+*.scm.in    diff=scheme
+*.texi      diff=texinfo
diff --git a/doc/contributing.texi b/doc/contributing.texi
index d1b77d7d05..a6bfcb82e0 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -992,9 +992,12 @@ Submitting Patches
 Development is done using the Git distributed version control system.
 Thus, access to the repository is not strictly necessary.  We welcome
 contributions in the form of patches as produced by @code{git
-format-patch} sent to the @email{guix-patches@@gnu.org} mailing list.
-Seasoned Guix developers may also want to look at the section on commit
-access (@pxref{Commit Access}).
+format-patch} sent to the @email{guix-patches@@gnu.org} mailing list
+(@pxref{submitting patches,, Submitting patches to a project, git, Git
+User Manual}).  Contributors are encouraged to take a moment to set some
+Git repository options (@pxref{Configuring Git}) first, which can
+improve the readability of patches.  Seasoned Guix developers may also
+want to look at the section on commit access (@pxref{Commit Access}).
 
 This mailing list is backed by a Debbugs instance, which allows us to
 keep track of submissions (@pxref{Tracking Bugs and Patches}).  Each
@@ -1205,11 +1208,46 @@ Submitting Patches
 When a bug is resolved, please close the thread by sending an email to
 @email{@var{NNN}-done@@debbugs.gnu.org}.
 
+@node Configuring Git
+@subsection Configuring Git
+@cindex git configuration
+@cindex @code{git format-patch}
+@cindex @code{git send-email}
+
+If you have not done so already, you may wish to set a name and email
+that will be associated with your commits (@pxref{telling git your name,
+, Telling Git your name, git, Git User Manual}).  If you wish to use a
+different name or email just for commits in this respository, you can
+use @command{git config --local}, or edit @file{.git/config} in the
+repository instead of @file{~/.gitconfig}.
+
+We provide some default settings in @file{etc/git/gitconfig} which
+modify how patches are generated, making them easier to read and apply.
+These settings can be applied by manually copying them to
+@file{.git/config} in your checkout, or by telling Git to include the
+whole file:
+
+@example
+git config --local include.path ../etc/git/gitconfig
+@end example
+
+From then on, any changes to @file{etc/git/gitconfig} would
+automatically take effect.
+
+Since the first patch in a series must be sent separately
+(@pxref{Sending a Patch Series}), it can also be helpful to tell
+@command{git format-patch} to handle the e-mail threading instead of
+@command{git send-email}:
+
+@example
+git config --local format.thread shallow
+git config --local sendemail.thread no
+@end example
+
 @unnumberedsubsec Sending a Patch Series
 @anchor{Sending a Patch Series}
 @cindex patch series
 @cindex @code{git send-email}
-@cindex @code{git-send-email}
 
 When sending a patch series (e.g., using @code{git send-email}), please
 first send one message to @email{guix-patches@@gnu.org}, and then send
diff --git a/doc/guix.texi b/doc/guix.texi
index 6436e83a7c..4dac36310f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -96,6 +96,7 @@
 Copyright @copyright{} 2021 Hui Lu@*
 Copyright @copyright{} 2021 pukkamustard@*
 Copyright @copyright{} 2021 Alice Brenon@*
+Copyright @copyright{} 2021 Sarah Morgensen@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
diff --git a/etc/git/gitconfig b/etc/git/gitconfig
new file mode 100644
index 0000000000..c9ebdc8fa8
--- /dev/null
+++ b/etc/git/gitconfig
@@ -0,0 +1,5 @@
+[diff "scheme"]
+	xfuncname = "^(\\(define.*)$"
+
+[diff "texinfo"]
+	xfuncname = "^@node[[:space:]]+([^,]+).*$"

base-commit: 808f9ffbd3106da4c92d2367b118b98196c9e81e
-- 
2.33.0





  parent reply	other threads:[~2021-09-20 23:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 22:39 [bug#50363] [PATCH v2] Improve default diff hunk header detection Sarah Morgensen
2021-09-10 17:07 ` Maxime Devos
2021-09-13 10:24 ` [bug#50363] [PATCH] " Ludovic Courtès
2021-09-19 18:36 ` [bug#50363] [PATCH v3] " Sarah Morgensen
2021-09-19 22:09   ` Kyle Meyer
2021-09-19 22:56     ` Sarah Morgensen
2021-09-20  0:57       ` Kyle Meyer
2021-09-20 23:37 ` Sarah Morgensen [this message]
2021-09-22 12:55   ` [bug#50363] [PATCH v4] " Ludovic Courtès
2021-09-22 16:22     ` Sarah Morgensen
2021-10-04 12:26       ` bug#50363: [PATCH] " Ludovic Courtès
2021-10-13 22:30         ` [bug#50363] " Marius Bakke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bbac973c0d0388fabe126bd44b60b0683ffe9f03.1632180690.git.iskarian@mgsn.dev \
    --to=iskarian@mgsn.dev \
    --cc=50363@debbugs.gnu.org \
    --cc=kyle@kyleam.com \
    --cc=ludo@gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).