Thread (1 message) 1 message, 1 author, 2026-02-14

Re: [PATCH v2 2/2] templates: detect commit messages containing diffs

From: Junio C Hamano <hidden>
Date: 2026-02-14 15:42:56

Phillip Wood [off-list ref] writes:
quoted
quoted
The trailing ".*" when matching commented lines
ensures that if the comment string ends with a "$" it is not treated
as an anchor.
I am not sure what this means.  Wouldn't these three

	sed -e '/^#/d'
	sed -e '/^#.*/d'
	sed -e '/^#.*$/d'

work exactly the same way?
They do, but if the comment string is '$' then these two

	sed -e '/^$/d'
	sed -e '/^$.*/d'

have different meanings
Ahh, that is what you meant.

Having to write "/^\$/" is inconvenient, because others characters
do not generally need the backslash (e.g., "/^\#/" and "/^#/" are
the same) and some characters even may become nonsensical if we
blindly add backslash to everybody (e.g., "/^\1/").

Nobody would use "[" as a commentchar, I hope, as "/^[/d" would not
work, and neither "/^[.*/d" does.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help