Skip to content
代码片段 群组 项目
提交 4ac0f62f 编辑于 作者: Fred de Gier's avatar Fred de Gier
浏览文件

Add MR conflict hook to Lefthook

上级 618df5ad
No related branches found
No related tags found
无相关合并请求
#!/bin/zsh
# Adjusted from https://gitlab.com/fdegier/pre-push-hooks with hardcoded values for speed
ORIGIN=origin
DEFAULT_BRANCH=master
if [[ -n "$ORIGIN" ]]
then
# Pull the default branch from remote
git fetch --quiet origin "$DEFAULT_BRANCH":"$DEFAULT_BRANCH"
fi
# Check for merge conflicts and abort
if git merge --autostash --no-commit --no-ff --no-edit "$DEFAULT_BRANCH" > /dev/null 2>&1
then
# Able to merge without conflicts
git merge --abort > /dev/null 2>&1
exit 0
else
echo "Merge conflicts detected when merging to $DEFAULT_BRANCH!"
git merge --abort > /dev/null 2>&1
exit 1
fi
......@@ -86,6 +86,9 @@ pre-push:
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: 'data/removals/*.yml'
run: echo "Changes to removals files detected. Checking removals..\n"; bundle exec rake gitlab:docs:check_removals
scripts:
"merge_conflicts":
runner: bash
pre-commit:
parallel: true
commands:
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册