[Kernel-handbook-general] [PATCH 2/3] Whitespace cleanup in the "common tasks" chapter
Jonathan Nieder
jrnieder at gmail.com
Mon Jun 6 01:50:22 UTC 2011
(-cc: the bug since this is a different topic)
Ben Hutchings wrote:
> While I think we should be consistent, the rules for indentation should
> first be discussed and then documented so that contributors can easily
> ensure that their editor follows them. I really don't want commit
> history to be cluttered with spacing changes.
Makes sense. Here's a rough proposal to get the discussion started.
-- >8 --
Subject: Encourage consistent use of spaces to indent
>From the beginning, the kernel handbook has used a mixture of tabs and
spaces with no consistent rule to choose between them. Let's pick an
arbitrary rule now: stick to spaces so the source looks reasonable
even when viewed with an unusual tab width.
This patch doesn't change the whitespace yet --- it just adds a README
explaining the rule and adds a .gitattributes so patches that add
lines violating it can stand out in "git log -p" and "git diff
--check" output.
Signed-off-by: Jonathan Nieder <jrnieder at gmail.com>
---
To try out the new rules:
$ git rm --cached *.sgml
$ git diff --cached -R | git apply --cached --whitespace=fix
$ git checkout .
(Except that it gets confused and fixes " ^I" on one line to ^I
instead of eight spaces.
$ git diff --check HEAD
chapter-packaging.sgml:27: tab in indent.
+ This package contains the Debian kernel source
)
.gitattributes | 1 +
README | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
create mode 100644 .gitattributes
create mode 100644 README
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9b0d861
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.sgml whitespace=!indent,tab,trail
diff --git a/README b/README
new file mode 100644
index 0000000..ea83ce6
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+This is Debian's kernel-handbook, a reference manual for:
+
+ * Working on the linux-2.6 package
+ * Building custom kernels and modules
+ * Working with initramfs images
+ * Kernel team policies
+
+See chapter-scope.sgml and debian/control for more information about
+the project.
+
+The SGML files use spaces, not tabs, to indent. You can catch tabs
+that slipped in before commiting by using git's sample pre-commit
+hook:
+
+ $ mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
--
1.7.5.3
More information about the Kernel-handbook-general
mailing list