📄 detect-merge-conflicts.sh
字号:
#!/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -