File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -56,25 +56,21 @@ jobs:
5656 # 2. Remove end-of-line comments (anything after '!' that isn't in a string)
5757 # 3. Preserve strings containing '!' characters
5858 sed -E '
59- :a # ① label for looping
60- /&$/ { # ② if the *current* line ends with “&”
61- N # read the *next* line into the pattern space
62- s/&[[:space:]]*\n[[:space:]]*&/ / # ③ delete the trailing “&”,
63- # the following newline, the
64- # leading “&” on the next line,
65- # and join them with one space
66- ba # ④ repeat until the next line no longer starts
67- # with “&” (handles runs of many “&” lines)
59+ :a
60+ /&$/ {
61+ N
62+ s/&[[:space:]]*\n[[:space:]]*&/ /
63+ ba
6864 }
69- s/&//g # ⑤ finally strip any stray “&” left in the file
70- ' "$file" > "$TMP_FILE" && mv "$TMP_FILE" "$file"
71-
65+ s/&//g
66+ ' "$file" | \
7267 sed -E \
7368 -e ' /^\s*!/s/.*//' \
7469 -e '/^[cC*dD]/s/.*//' \
7570 -e '/^[ \t]*[cC*dD]/s/.*//' \
7671 -e 's/([^"'\'']*("[^"]*"[^"'\'']*|'\''[^'\'']*'\''[^"'\'']*)*[^"'\'']*)[!].*$/\1/' \
77- " $file" > "$TMP_FILE" && mv "$TMP_FILE" "$file"
72+ > "$TMP_FILE"
73+
7874 # Check if file was actually modified before replacing
7975 if cmp -s "$file" "$TMP_FILE"; then
8076 echo -e "No changes needed for $file"
You can’t perform that action at this time.
0 commit comments