[RFC/PATCH] dontdiff: generate from gitignore

Previous thread: Lenovo 3000 N100 i8042 problems by Daniel Barkalow on Monday, September 1, 2008 - 2:46 pm. (29 messages)

Next thread: [PATCH 0/13] Turn hrtimers into a range capable timer by Arjan van de Ven on Monday, September 1, 2008 - 4:03 pm. (46 messages)
From: Arjan van de Ven
Date: Monday, September 1, 2008 - 3:09 pm

With the new firmware infrastructure in 2.6.27, some files are generated and shouldn't be
diffed; add these 2 to the "dontdiff" file

Signed-off-by: Arjan van de Ven <arjan@Linux.intel.com>

diff -purN --exclude-from=linux.trees.git/Documentation/dontdiff /home/arjan/linux.trees.git/Documentation/dontdiff linux.trees.git/Documentation/dontdiff
--- linux.trees.git/Documentation/dontdiff	2008-05-01 13:13:42.000000000 -0700
+++ linux.trees.git/Documentation/dontdiff	2008-09-01 15:09:16.000000000 -0700
@@ -5,6 +5,8 @@
 *.css
 *.dvi
 *.eps
+*.fw.gen.S
+*.fw
 *.gif
 *.grep
 *.grp
--

From: Alexey Dobriyan
Date: Monday, September 1, 2008 - 4:14 pm

Dontdiff is obsoleted because of .gitignore and should probably be auto-generated
from them.

--

From: Randy Dunlap
Date: Friday, September 12, 2008 - 10:17 am

Let's please not assume that everyone uses git nor force that.

---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

From: Randy Dunlap
Date: Friday, September 12, 2008 - 10:17 am

defkeymap.c_shipped should be diffed if it is changed.
Reported-by: Mike Galbraith <efault@gmx.de>

COPYING, CREDITS, .mailmap should be diffed if they are changed.
keywords.c_shipped & lex.c_shipped should be diffed when changed.
parse.[ch]_shipped should be diffed when changed.
Reported-by: Sam Ravnborg <sam@ravnborg.org>

vsyscall* updates from a .gitignore patch by "Denis V. Lunev" <den@openvz.org>.

*.so.dbg from a .gitignore patch by Thomas Gleixner <tglx@linutronix.de>.

binoffset from a .gitignore patch by Uwe Kleine-K=F6nig <Uwe.Kleine-Koenig@digi.com>.

Module.markers from a .gitignore patch by Matthew Wilcox <willy@linux.intel.com>.

vmlinux*.lds* should be diffed if changed.
Reported-by: Etienne Lorrain <etienne_lorrain@yahoo.fr>

vmlinux.lds from a .gitignore patch by Daniel Guilak <daniel@danielguilak.com>.

*.scr should be diffed if changed.

Lots of updates from http://lkml.org/lkml/2008/5/20/32
Reported-by: Bart Van Assche <bart.vanassche@gmail.com>

Use ncscope.* instead of *cscope* since the latter may catch too many files.

Add *.elf, from a .gitignore patch by Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>.

Make firmware entries match .gitignore entries.

Make some entries less greedy by removing trailing '*'.

Remove "make_times_h" (no such file).
Remove "filelist" (no such file).
Remove "dummy_sym.c" (no such file).
Remove "gen-kdb_cmds.c" (no such file).
Remove "gentbl" (no such file).
Remove "kconfig.tk" (no such file).
Remove "tkparse" (no such file).
Remove "sim710_d.h" (no such file).
Remove "53c8xx_d.h" (no such file).
Add "syscalltab.h" (generated file).

---
 Documentation/dontdiff |   59 +++++++++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 26 deletions(-)

--- linux-2.6.27-rc6-git2.orig/Documentation/dontdiff
+++ linux-2.6.27-rc6-git2/Documentation/dontdiff
@@ -2,11 +2,13 @@
 *.aux
 *.bin
 *.cpio
-*.css
+*.csp
+*.dsp
 *.dvi
+*.elf
 *.eps
-*.fw.gen.S
 *.fw
+*.gen.S
 ...
From: Randy Dunlap
Date: Friday, September 12, 2008 - 10:18 am

From: Randy Dunlap <randy.dunlap@oracle.com>

Generate the "dontdiff" file from the .gitignore files.
Save it in scripts/dontdiff.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 Makefile           |   10 +++++++++-
 scripts/.gitignore |    1 +
 scripts/mkdontdiff |   23 +++++++++++++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

--- linux-2.6.27-rc6-git2.orig/Makefile
+++ linux-2.6.27-rc6-git2/Makefile
@@ -398,7 +398,7 @@ endif
 no-dot-config-targets := clean mrproper distclean \
 			 cscope TAGS tags help %docs check% \
 			 include/linux/version.h headers_% \
-			 kernelrelease kernelversion
+			 kernelrelease kernelversion dontdiff
 
 config-targets := 0
 mixed-targets  := 0
@@ -1251,6 +1251,7 @@ help:
 	@echo  '  dir/            - Build all files in dir and below'
 	@echo  '  dir/file.[ois]  - Build specified target only'
 	@echo  '  dir/file.ko     - Build module including final link'
+	@echo  '  dontdiff        - Create a "dontdiff" file'
 	@echo  '  prepare         - Set up for building external modules'
 	@echo  '  tags/TAGS	  - Generate tags file for editors'
 	@echo  '  cscope	  - Generate cscope index'
@@ -1519,6 +1520,13 @@ endef
 tags: FORCE
 	$(call cmd,tags)
 
+quiet_cmd_dontdiff = MAKE    dontdiff
+      cmd_dontdiff = $(shell $(CONFIG_SHELL) \
+	                  $(srctree)/scripts/mkdontdiff $(srctree))
+
+dontdiff: FORCE
+	$(call cmd,dontdiff)
+
 
 # Scripts to check various things for consistency
 # ---------------------------------------------------------------------------
--- /dev/null
+++ linux-2.6.27-rc6-git2/scripts/mkdontdiff
@@ -0,0 +1,23 @@
+#! /bin/sh
+set -f
+
+TMPFILE=`mktemp ./.tmpdd.XXXXXX`
+srctree=$1
+DDFILE=$srctree/scripts/dontdiff
+
+find . -name .gitignore | xargs cat | grep -v '^[#!]' | grep -v '^[:space:]*$' | sort | uniq > $TMPFILE
+
+rm -f $DDFILE
+touch $DDFILE
+
+while read PATTERN ; do
+	if echo "$PATTERN" | grep -q '/' ; then
+		filename=`basename ...
From: Linus Torvalds
Date: Friday, September 12, 2008 - 10:36 am

t's not quite as simple as that, though.

The .gitignore files are fundamentally location hierarchy-aware, so a 
ignore entry in one subdirectory only affects that subdirectory 
(recursively), so if you flatten then, you should take that into account.

As far as I can tell, your script will generate lots of incorrect entries 
due to this. Eg, it will generate

	parse.[ch]

as a dontdiff pattern, because scripts/genksyms/.gitignore has that, but 
that means that now it will ignore parse.c in all the _other_ places, 
where it *isn't* a generated file (ie mm/parse.c).

		Linus
--

From: Randy Dunlap
Date: Friday, September 12, 2008 - 10:41 am

Yes, that's one of the reasons that it contains "RFC" in $subject.
There's also no handling of !pattern .gitignore lines....

AFAIK, diff with a dontdiff file does not allow/support full pathname
hierarchies like .gitignore does, so this is probably a futile exercise.  ??

-- 
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--

From: Kai Henningsen
Date: Friday, September 12, 2008 - 1:32 pm

I'm presuming you're talking about this diff option?

`-X FILE'
`--exclude-from=FILE'
     When comparing directories, ignore files and subdirectories whose
     basenames match any pattern contained in FILE.  *Note Comparing
     Directories::.

Indeed: it clearly says "basename" here.

If it weren't for that, you could just use git-ls-files --ignore to
find them ...
--

Previous thread: Lenovo 3000 N100 i8042 problems by Daniel Barkalow on Monday, September 1, 2008 - 2:46 pm. (29 messages)

Next thread: [PATCH 0/13] Turn hrtimers into a range capable timer by Arjan van de Ven on Monday, September 1, 2008 - 4:03 pm. (46 messages)