All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Todd Zullinger <tmz@pobox.com>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Zefram <zefram@fysh.org>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH] diff-tree: obey the color.ui configuration
Date: Sat, 30 Dec 2017 16:04:50 +0100	[thread overview]
Message-ID: <87po6w6yul.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20171230144505.GA29252@sigill.intra.peff.net>


On Sat, Dec 30 2017, Jeff King jotted:

> On Sat, Dec 30, 2017 at 01:33:06PM +0100, Ævar Arnfjörð Bjarmason wrote:
>
>> >   - we ended up with 33c643bb08 (Revert "color: check color.ui in
>> >     git_default_config()", 2017-10-13), which just reverts the whole
>> >     mess back to the pre-v2.14 state. This shipped in v2.15.
>>
>> Thanks. What a mess.
>>
>> I haven't tried that add-interactive case you mentioned, an earlier
>> version of this patch where I tried adding the color detection in
>> git_diff_basic_config() did break one of its tests, but not my ptch, but
>> it's probably still broken with =always (haven't tested.
>
> It should break a test, since I added one in 33c643bb083. :)

Right, the one I tried first broke that, but not this version....

> That covers "add -p", though, which only does diff-files under the hood.
> You can convince it to run "diff-index", too, but I don't think
> diff-tree. So technically your patch doesn't break add--interactive, but
> probably does break some other script we don't know about. ;)

...Yeah, for sure.

>> > So I don't think we want to go down that road again. If anything, we
>> > want to either fix the original sin from 4c7f1819b3, or we want to do
>> > the "respect only never" hack.
>>
>> Getting back to the bug report that prompted this whole thing, wouldn't
>> the easiest solution just to run "git show --stat $commit" instead of
>> "git diff-tree --pretty $commit" when bisect wants to report the commit
>> it found?
>>
>> I've always thought the output was a bit ugly, it's plumbing command, so
>> why wouldn't we just show the commit as the user usually prefers to see
>> commits?
>
> I like that solution. I've often found the output ugly, too. And in
> particular, it doesn't show any output at all for merge commits. Doing
> "diff-tree --cc --stat" would be the minimal output improvement there.
>
> I do like the idea of using "show", though. We know the point is to show
> the output to the user, so we don't mind at all if the behavior or
> output of show changes in future versions (unless we consider the final
> output of bisect to be machine-readable, but I certainly don't).

Not knowing the internal APIs for that well, is this basically a matter
of copy/pasting (or factoring out into a function), some of this:

    git grep -W cmd_show -- builtin/log.c

I.e. boilerplate + calling cmd_log_walk() to yield a result similar to
e22278c0a0 ("bisect: display first bad commit without forking a new
process", 2009-05-28).

Or is it preferred to just fake up argc/argv and call cmd_show()
directly? I haven't seen many examples of that in the codebase:

    git grep -W '(return|=)\s*cmd.*argc' -- '*.c'

But I don't see why it wouldn't work, the cmd_show() doesn't call exit()
itself, and we're right about to call exit anyway when our current
diff-tree invocation is called.

  reply	other threads:[~2017-12-30 15:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 19:47 [BUG] git bisect colour output contrary to configuration Zefram
2017-12-29 22:05 ` Ævar Arnfjörð Bjarmason
2017-12-29 22:51   ` [PATCH] diff-tree: obey the color.ui configuration Ævar Arnfjörð Bjarmason
2017-12-29 23:16     ` Todd Zullinger
2017-12-30  1:55       ` Jeff King
2017-12-30 12:33         ` Ævar Arnfjörð Bjarmason
2017-12-30 14:45           ` Jeff King
2017-12-30 15:04             ` Ævar Arnfjörð Bjarmason [this message]
2017-12-30 18:15               ` Jeff King
2017-12-30 23:01                 ` Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87po6w6yul.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=tmz@pobox.com \
    --cc=zefram@fysh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.