Re: git: 566cc005812b - main - safe_set treat ':' and '#' differently

From: Dag-Erling_Smørgrav <des_at_FreeBSD.org>
Date: Mon, 27 Apr 2026 18:31:29 UTC
"Simon J. Gerraty" <sjg@juniper.net> writes:
> Dag-Erling Smørgrav <des@freebsd.org> wrote:
> > >     Treat '#' as a comment anywhere,
> > >     but ':' only at start of line.
> > 
> > I can't quite figure out what your goal is with this, but it doesn't
> > seem right: `:` is not at all a comment, it is just a built-in alias for
> > the `true` command.  Among other things, this means that (assuming a
> > clean environment) these lines do absolutely nothing:
>
> Not quite.
> I use lines like:
>
> 	: tag=$tag
>
> to aid debugging.  Eg:
>
> 	for tag in `IFS=,; echo $DEBUG_SH`
>         do
>                 : tag=$tag
>                 case "$tag" in
>
> without the : tag=$tag one cannot tell what the value of tag is
> in the set -x output.
>
> The goal here is to ensure a line like that will be ignored.

That's beside the point, which is that your regex is incorrect.  It will
treat e.g. `:foo` as a comment.

DES
-- 
Dag-Erling Smørgrav - des@FreeBSD.org