From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH 2/2] pkt-line: show packets in async processes as "sideband"
Date: Tue, 01 Sep 2015 15:13:25 -0700 [thread overview]
Message-ID: <xmqq1tehrdoa.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20150901202412.GA8020@sigill.intra.peff.net> (Jeff King's message of "Tue, 1 Sep 2015 16:24:13 -0400")
Jeff King <peff@peff.net> writes:
> What we really need is thread-local storage for
> packet_trace_identity. But the async code does not provide
> an interface for that, and it would be messy to add it here
> (we'd have to care about pthreads, initializing our
> pthread_key_t ahead of time, etc).
True.
> So instead, let us just assume that any async process is
> handling sideband data. That's always true now, and is
> likely to remain so in the future.
Hmm, does Stefan's thread-pool thing interact with this decision in
any way?
>
> The output looks like:
>
> packet: sideband< \1000eunpack ok0019ok refs/heads/master0000
> packet: push< unpack ok
> packet: push< ok refs/heads/master
> packet: push< 0000
> packet: sideband< 0000
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> pkt-line.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/pkt-line.c b/pkt-line.c
> index 08a1427..62fdb37 100644
> --- a/pkt-line.c
> +++ b/pkt-line.c
> @@ -1,5 +1,6 @@
> #include "cache.h"
> #include "pkt-line.h"
> +#include "run-command.h"
>
> char packet_buffer[LARGE_PACKET_MAX];
> static const char *packet_trace_prefix = "git";
> @@ -11,6 +12,11 @@ void packet_trace_identity(const char *prog)
> packet_trace_prefix = xstrdup(prog);
> }
>
> +static const char *get_trace_prefix(void)
> +{
> + return in_async() ? "sideband" : packet_trace_prefix;
> +}
> +
> static int packet_trace_pack(const char *buf, unsigned int len, int sideband)
> {
> if (!sideband) {
> @@ -57,7 +63,7 @@ static void packet_trace(const char *buf, unsigned int len, int write)
> strbuf_init(&out, len+32);
>
> strbuf_addf(&out, "packet: %12s%c ",
> - packet_trace_prefix, write ? '>' : '<');
> + get_trace_prefix(), write ? '>' : '<');
>
> /* XXX we should really handle printable utf8 */
> for (i = 0; i < len; i++) {
next prev parent reply other threads:[~2015-09-01 22:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-01 20:22 [PATCH 0/2] clarify sideband muxing in GIT_TRACE_PACKET Jeff King
2015-09-01 20:22 ` [PATCH 1/2] run-command: provide in_async query function Jeff King
2015-09-01 20:26 ` Jeff King
2015-09-01 22:09 ` Junio C Hamano
2015-09-01 22:17 ` Jeff King
2015-09-01 20:24 ` [PATCH 2/2] pkt-line: show packets in async processes as "sideband" Jeff King
2015-09-01 22:13 ` Junio C Hamano [this message]
2015-09-01 22:22 ` Jeff King
2015-09-01 22:23 ` Stefan Beller
2015-09-01 22:26 ` Jeff King
2015-09-01 22:31 ` Stefan Beller
2015-09-01 22:38 ` Jeff King
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=xmqq1tehrdoa.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=sbeller@google.com \
/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.