Re: [PATCH] Teach/Fix git-pull/git-merge --quiet and --verbose
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 16, 2008, 06:15 UTC
- Message-ID
- <7vtzbdjcb8.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <4ac8254d0810152254i615bca9dye0aedd8689c946e7@mail.gmail.com>
"Tuncer Ayaz" <tuncer.ayaz@gmail.com> writes:
Show 7 quoted lines
> On Thu, Oct 16, 2008 at 2:07 AM, Junio C Hamano <gitster@pobox.com> wrote: >> "Tuncer Ayaz" <tuncer.ayaz@gmail.com> writes: >> >>> On Wed, Oct 15, 2008 at 9:06 PM, Junio C Hamano <gitster@pobox.com> wrote: >>>> "Tuncer Ayaz" <tuncer.ayaz@gmail.com> writes: >>>> > Would you prefer to leave -v out?
Not at all.
Perhaps there is a deeper misunderstanding.
It makes perfect sense _at the end user interface level_ to have -v and -q as two separate options, perhaps with "later one wins" semantics. Another possible semantics is "-q and -v are mutually incompatible", but I think "later one wins" makes it much more usable from the end user's point of view.
The only thing I was objecting to was your repeated (verbose || !quiet) expression in the _implementation_, which would have been much easier to read and maintain, if it were expressed as a single variable "verbosity" that can have one of three values.
IOW,
static enum { QUIET, NORMAL, VERBOSE } verbosity = NORMAL;
... if (!strcmp("--quiet", arg))
verbosity = QUIET;
else if (!strcmp("--verbose", arg))
verbosity = VERBOSE;
else ... ...
if (verbosity > QUIET)
print informational message;
if (verbosity > NORMAL)
print verbose message;See?