Would using double slashes in the middle of a line have the effect of commenting?

From Ignoring Files:

A line beginning with // is a comment and has no effect.

Does that mean using // in the middle of a line will have no effect on commenting? That is, if your line is

file // comment

Then it will literally search for a file named file // comment, not file?

I’m not sure what the effect of double slashes are inside a pattern (maybe they’re cleaned to the equivalent single slash?) but according the docs it should not be interpreted as a comment, no.

Edit: looks like double slash will match only a double slash, i.e, not match anything at all since there won’t be any double slashes in a normal path name.

but why not allow the double slash in the middle of a line to have the effect of commenting as well?

I don’t remember why, that decision was made many years ago.

Linux paths can have spaces and // etc. So its not safe.

Spaces yes but slashes no… That said, it seems like a possible typo so having foo/bar//baz/quux be a failure (no match) seems better to me than having it silently matching all of foo/bar because the rest suddenly became a comment.

In either case, it pretty much is what it is at this point, I see no pressing reason to change it.

I see. Should I add this info to the doc for more clarity?

Sure, go ahead, PR welcome. I think it’s a worthwhile clarification.