On Tue, Jun 06, 2023 at 02:22:15PM +0900, Junio C Hamano wrote: > Patrick Steinhardt writes: > > >> Hmph, I expected "-z" and "-Z" to be orthogonal, the former > >> controlling how input records are delimited, the latter controlling > >> how output records are delimited, as it usually is a good idea to > >> keep things that could be orthogonal to be orthogonal to avoid > >> unnecessarily robbing users flexibility. "-Z is a new way that is > >> preferred over -z" was something I did not expect, actually. > >> > >> I am not outright rejecting such a deliberately limiting design, but > >> I'll have to think about it a bit. > > > > Well, the way I see it we shouldn't have ever decoupled the input and > > output format, and I consider it a bug that `-z` did as it makes it > > unusable with arbitrary input. So I'd rather be helping the user of > > these modes to do the right thing and NUL-delimit both input and output > > than running into these edge cases later down the road. > > If that is the direction we want to go in, then the title of this > step must be updated to say "-Z" does both output and input. Also > with the same number of bytes it takes to say "new option", you can > say what that new option is, so do that. Sorry, my v2 and your mail crossed, so the new title doesn't yet mention `-Z`. I agree it would make sense to do so, and if there's a v3 I'll change it accordingly. Otherwise, please feel free to change: cat-file: introduce option to delimit input and output with NUL to cat-file: introduce `-Z` to delimit input and output with NUL > > That being said I'd be fine to change this series to mean "-Z changes > > stdout" if you insist. In that case we should be pointing out in our > > documentation that "You should never use `-z` without `-Z` when you > > process arbitrary input". > > You are not making sense. If we were to leave them orthogonal to > keep flexibility, it is because there can be cases where using '-Z' > without using '-z' (and vice versa) makes sense; "you should never" > has no place to live in such a world. Well, that's exactly what I'm arguing: I don't think it does make sense to keep them orthogonal. I cannot think of usecases where you'd want to only change either of those options once you start processing arbitrary input. If you exactly know that your input doesn't contain newlines then you don't need either `-z` nor `-Z`. On the other hand, if it does, then you must be using both. I only proposed the alternative with the intent of being diplomatic and not fully close the door on your remark in case you felt strongly about it. I've thus sent v2 to double down on my current approach where `-Z` changes both stdin and stdout and tried to make a better case for it in the commit message. Patrick