Skip to content
Browse files

Add pre-commit check not for deleted files

  • Loading branch information...
1 parent 348b933 commit 4d02da7240f80a70de29a0fec4d5c6c68ec5c623 @abtris committed Dec 13, 2012
Showing with 9 additions and 9 deletions.
  1. +9 −9 Day2/Uloha-2/pre-commit
View
18 Day2/Uloha-2/pre-commit
@@ -46,7 +46,7 @@
# that subprograms fail to launch unless invoked via absolute path.
# If you're having unexpected problems with a hook program, the
# culprit may be unusual (or missing) environment variables.
-#
+#
# Here is an example hook script, for a Unix /bin/sh interpreter.
# For more examples and pre-written hooks, see those in
# the Subversion repository at
@@ -74,24 +74,24 @@ SVNLOOK=/usr/bin/svnlook
# "$REPOS" "$TXN" "$REPOS"/commit-access-control.cfg || exit 1
-# check xml
-CHANGEDXML=`$SVNLOOK changed -t "$TXN" "$REPOS" | $AWK '{print $2}' | $GREP \\.xml$`
+# check xml
+CHANGEDXML=`$SVNLOOK changed -t "$TXN" "$REPOS" | $GREP -v ^D | $AWK '{print $2}' | $GREP \\.xml$`
#echo "$CHANGEDXML" >>$LOG
-for FILE in $CHANGEDXML
-do
- $SVNLOOK cat -t "$TXN" "$REPOS" "$FILE" > $TMPFILE
+for FILE in $CHANGEDXML
+do
+ $SVNLOOK cat -t "$TXN" "$REPOS" "$FILE" > $TMPFILE
OUT=`$XMLLINT --noout $TMPFILE 2>&1`
#echo "OUTPUT: $OUT" >>$LOG
#echo "CODE: $?" >>$LOG
- if [ $? -ne 0 ]
+ if [ $? -ne 0 ]
then
echo "---------------------------------------" >&2
echo "XML error in: $FILE:" >&2
echo "---------------------------------------" >&2
echo $OUT >&2
exit 1
- fi
-done
+ fi
+done
# All checks passed, so allow the commit.
exit 0

0 comments on commit 4d02da7

Please sign in to comment.
Something went wrong with that request. Please try again.