summaryrefslogtreecommitdiff
path: root/qa/check-gitignore
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
commit47e6e7c84f008a53061e661f31ae96629bc694ef (patch)
tree648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/check-gitignore
downloadpcp-debian.tar.gz
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/check-gitignore')
-rwxr-xr-xqa/check-gitignore43
1 files changed, 43 insertions, 0 deletions
diff --git a/qa/check-gitignore b/qa/check-gitignore
new file mode 100755
index 0000000..9c2603f
--- /dev/null
+++ b/qa/check-gitignore
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# check .gitignore
+#
+
+#debug# tmp=/var/tmp/$$
+tmp=`pwd`/tmp
+sts=0
+#debug# trap "rm -f $tmp.*; exit \$sts" 0 1 2 3 15
+rm -f $tmp.*
+
+if [ ! -f .gitignore ]
+then
+ echo "No .gitignore here, do you know what you're doing?"
+ sts=1
+ exit $sts
+fi
+
+# check for .gitignore lines that do not match any existing file
+#
+sed -e '/^#/d' .gitignore \
+| while read pat
+do
+ for file in $pat
+ do
+ if [ ! -f "$file" ]
+ then
+ echo "Warning: no file matching .gitignore line: $pat"
+ else
+ echo "$file" >>$tmp.ignore
+ fi
+ done
+done
+
+sort -o $tmp.ignore $tmp.ignore
+
+git status \
+| awk '
+/Untracked files:/ { state = 1; next }
+state == 1 && /to include in what will be committed/ { state = 2; next }
+state == 2 { print }' \
+| sed -e 's/^#[ ]*//' >$tmp.status
+