Skip to content

Commit

Permalink
Merge pull request #12239 from NixOS/mergify/bp/2.24-maintenance/pr-1…
Browse files Browse the repository at this point in the history
…2237

Reject merge conflicts (backport #12237)
  • Loading branch information
mergify[bot] authored Jan 15, 2025
2 parents 6e718c7 + 1422832 commit c6f504d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions maintainers/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@
# https://flake.parts/options/pre-commit-hooks-nix.html#options
pre-commit.settings = {
hooks = {
# Conflicts are usually found by other checks, but not those in docs,
# and potentially other places.
check-merge-conflicts.enable = true;
# built-in check-merge-conflicts seems ineffective against those produced by mergify backports
check-merge-conflicts-2 = {
enable = true;
entry = "${pkgs.writeScript "check-merge-conflicts" ''
#!${pkgs.runtimeShell}
conflicts=false
for file in "$@"; do
if grep --with-filename --line-number -E '^>>>>>>> ' -- "$file"; then
conflicts=true
fi
done
if $conflicts; then
echo "ERROR: found merge/patch conflicts in files"
exit 1
fi
touch $out
''}";
};
clang-format = {
enable = true;
excludes = [
Expand Down

0 comments on commit c6f504d

Please sign in to comment.