Follow

oh i am thinking about spaces in filenames, and feel the ash of special cases and complexity falling over my bright clean code

@mala git doesn't fully support newlines in filenames and I have users who file bugs on my software (not git) about this

@joeyh @mala Do they actually use newlines in filenames, or is this a "it's in the spec, darnit!" situation?

@hirnbrot @joeyh you *can* use newlines in filenames, so git should really handle it. You can use *anything* in filenames except '/' and the null character, I think.

@mala @joeyh Yes, you _can_. It's not strictly necessary according to POSIX (that only requires characters from the "portable" set).

The bigger issue is whether you _should_. Seriously, I get spaces in filenames, but newlines? That's going to break _much_ more than spaces, and without them a whole bunch of naive shellscript suddenly becomes correct (`ls | something` or `find | something` without "-print0").

@mala @hirnbrot indeed, and git mostly supports them, but eg, the git cat-file --batch interface is line based and has no way to switch to null termination

I think that may be the only part of git that uses a line based protocol and does not support -z. It would be worth fixing if you care about newlines in filenames.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!