[PATCH v1 1/1] syntax-highlight: when the file has no extension, assume text

Ferry Huberts mailings at hupie.com
Wed Apr 4 18:05:55 CEST 2012


From: Ferry Huberts <ferry.huberts at pelagic.nl>

Better than setting the extension to the filename, which is
what now happens.

Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
---
 filters/syntax-highlighting.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 5fcc9c9..fa597b8 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -39,6 +39,11 @@
 BASENAME="$1"
 EXTENSION="${BASENAME##*.}"
 
+if [ "${BASENAME}" == "${EXTENSION}" ]; then
+  # the file has no extension, assume text
+  EXTENSION="txt"
+fi
+
 # map Makefile and Makefile.* to .mk
 [ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk
 
-- 
1.7.7.6





More information about the CGit mailing list