aboutsummaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-07 20:25:30 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-07 20:27:13 +0800
commit67083d3173197c0a247f7b32300ee007749fa939 (patch)
treeb6845c08dc01caa79da6a7350509b8c7127cc56f /utils.go
parenthooks: Simplify comments in the hook client (diff)
downloadforge-67083d3173197c0a247f7b32300ee007749fa939.tar.gz
forge-67083d3173197c0a247f7b32300ee007749fa939.tar.zst
forge-67083d3173197c0a247f7b32300ee007749fa939.zip
repo/index: Emit warning when path contains newline
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils.go b/utils.go
new file mode 100644
index 0000000..f0b352d
--- /dev/null
+++ b/utils.go
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>
+
+package main
+
+import "strings"
+
+func slice_contains_newline(s []string) bool {
+ for _, v := range s {
+ if strings.Contains(v, "\n") {
+ return true
+ }
+ }
+ return false
+}