Hook script to block commit of files having a particular string

前端 未结 1 2022
一向
一向 2021-01-23 00:22

I have implemented the below code in my hook script file abc-pre-commit.bat to disallow commit if files contain the string cod_bank

SET         


        
相关标签:
1条回答
  • 2021-01-23 01:04

    In Linux It works like this:

    #!/bin/sh
    REPOS="$1"
    TXN="$2"
    
    
    SVNLOOK=/usr/bin/svnlook
    $SVNLOOK diff "$REPOS" -t "$TXN" | \
    [[ grep "^+cod_bank">/dev/null exit 0 ]]  ||
    echo "Your commit has been blocked because it contains the keyword cod_bank"  >&2
    exit 1
    
    0 讨论(0)
提交回复
热议问题