#! /bin/sh /usr/share/dpatch/dpatch-run
## 08_516143_xml_is_text.dpatch by Y Giridhar Appaji Nag <appaji@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Don't classify XML files as non-text, thanks "J.P. Delport"
## DP: <jpdelport@csir.co.za> for the bug report #516143 and the patch.

@DPATCH@
diff -urNad xxdiff-3.2~/lib/python/xxdiff/utils.py xxdiff-3.2/lib/python/xxdiff/utils.py
--- xxdiff-3.2~/lib/python/xxdiff/utils.py	2008-09-30 18:03:57.000000000 +0530
+++ xxdiff-3.2/lib/python/xxdiff/utils.py	2009-02-24 14:48:08.000000000 +0530
@@ -59,6 +59,7 @@
 # options were taken from Ian F. Darwin's file implementation.
 guesscmd = ['file', '-b', '-L']
 text_re = re.compile('\\btext\\b')
+xml_re = re.compile('\\bXML\\b')
 empty_re = re.compile('^empty$')
 
 def istextfile(fn):
@@ -75,7 +76,7 @@
     if p.returncode != 0 or stderr or stdout.startswith('cannot open'):
         raise RuntimeError("Error: Running 'file' on '%s'." % fn)
 
-    return bool(text_re.search(stdout) or empty_re.match(stdout))
+    return bool(text_re.search(stdout) or xml_re.search(stdout) or empty_re.match(stdout))
 
 
 #-------------------------------------------------------------------------------
