summaryrefslogtreecommitdiffstats
path: root/vendor/gix/src/assets/init/hooks/pre-commit.sample
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/gix/src/assets/init/hooks/pre-commit.sample
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/gix/src/assets/init/hooks/pre-commit.sample')
-rwxr-xr-xvendor/gix/src/assets/init/hooks/pre-commit.sample19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/gix/src/assets/init/hooks/pre-commit.sample b/vendor/gix/src/assets/init/hooks/pre-commit.sample
new file mode 100755
index 000000000..9d256d4c6
--- /dev/null
+++ b/vendor/gix/src/assets/init/hooks/pre-commit.sample
@@ -0,0 +1,19 @@
+#!/bin/sh
+# A sample hook to prevent commits with merge-markers
+#####################################################
+# This example hook rejects changes that are about to be committed with merge markers,
+# as that would be a clear indication of a failed merge. It is triggered by `git commit`
+# and returning with non-zero exit status prevents the commit from being created.
+#
+# To enable this hook remove the `.sample` suffix from this file entirely.
+
+# Check for merge markers in modified files
+for file in $(git diff --cached --name-only); do
+ if grep -q -E '^(<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|)$' "$file"; then
+ echo "Error: File '$file' contains merge markers. Please remove them before committing."
+ exit 1
+ fi
+done
+
+# Exit with success if there are no errors
+exit 0