detect-merge-conflicts.sh
来自「subversion-1.4.3-1.tar.gz 配置svn的源码」· Shell 代码 · 共 33 行
SH
33 行
#!/bin/sh## A pre-commit hook to detect changes that look like forgotten# conflict markers. If any additions starting with '>>>>>>>',# '=======' or '<<<<<<<' are found, the commit is aborted with a nice# error message.#REPOS=$1TXN=$2SVNLOOK=/usr/bin/svnlook# Check argumentsif [ -z "$REPOS" -o -z "$TXN" ]; then echo "Syntax: $0 path_to_repos txn_id" >&2 exit 1fi# We scan through the transaction diff, looking for things that look# like conflict markers. If we find one, we abort the commit.SUSPICIOUS=$($SVNLOOK diff -t "$TXN" "$REPOS" | grep -E '^\+(<{7}|={7}|>{7})' | wc -l)if [ $SUSPICIOUS -ne 0 ]; then echo "Some parts of your commit look suspiciously like merge" >&2 echo "conflict markers. Please double-check your diff and try" >&2 echo "committing again." >&2 exit 1fi# No conflict markers detected, let it fly!exit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?