SVN pre-commit hook for avoiding changes to tags subdirectories

前端 未结 11 650
陌清茗
陌清茗 2020-11-28 04:25

Is there anybody who has clear instructions on how to add a pre-commit hook that avoids changes to tags subdirectories?

I already searched the internet quite a bit.

11条回答
  •  清酒与你
    2020-11-28 04:57

    The accepted answer prevents updating files in a tag but doesn't prevent adding files to a tag. The following version handles both:

    #!/bin/sh
    
    REPOS="$1"
    TXN="$2"
    SVNLOOK="/home/staging/thirdparty/subversion-1.6.17/bin/svnlook"
    
    # Committing to tags is not allowed
    $SVNLOOK changed -t "$TXN" "$REPOS" --copy-info| grep -v "^ " | grep -P '^[AU]   \w+/tags/' && /bin/echo "Cannot update tags!" 1>&2 && exit 1
    
    # All checks passed, so allow the commit.
    exit 0
    

提交回复
热议问题