Re: [GSoC PATCH v2 1/2] repo: add the flag -z as an alias for --format=nul
- From
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
- Date
- Sep 1, 2025, 13:50 UTC
- Message-ID
- <FBD7B727-BE36-45FF-BD19-8086701C9753@gmail.com>
- In-Reply-To
- <xmqqcy8frqn2.fsf@gitster.g>
Show 5 quoted lines
> Putting the devil's advocate hat on, "--format=<plain,nul>" was an > attempt to avoid needless proliferation of options (e.g. presense of > "-z" would tempt people into add "--json" when they introduce > "--format=json"), so it may not be unconditionally a good idea to > mimic these older commands where there are only two output formats.
Yeah, I understand...
Show 7 quoted lines
> You'd probably need to define a parseopt callback function for > "format" and "-z", and remember the one that you saw the last. So > giving "-z --format=nul --format=text" would first set an internal > "format" to FORMAT_NUL_TERMINATED (due to "-z"), and then to the > same FORMAT_NUL_TERMINATED again (due to "--format=nul"), and then > finally to FORMAT_TEXT (due to "--format=text"), or something like > that, which would give the familiar "the last one wins" semantics.
Ok, accepted! I'll also replace the tests and the documentation in order to match this behavior. Thanks!