From: iheffner@gmail.com
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "Junio C Hamano" <gitster@pobox.com>,
"Dave Olszewski" <cxreg@pobox.com>
Subject: [PATCH 0/3] use constants for sideband communication channels
Date: Tue, 13 Dec 2011 10:28:48 -0800 [thread overview]
Message-ID: <1323800931-37123-1-git-send-email-iheffner@gmail.com> (raw)
In order to make more clear how the different channels in sidechannel.c
are to be used, I'm proposing some macros/constants which can be used in
place of the "magic numbers" that mean little or nothing to someone not
familiar with the protocol.
In working on a script to handle archiving from a bare repository a
project which contained submodules, I had a difficult time determining
how to talk between my git-upload-archive replacement and git-archive.
It did not occur to me to look at documentation for git-send-pack or
git-receive-pack when trying to understand the communication protocol.
But looking through the code and poking at an implementation, I finally
understood that I needed to send a channel identifier to say what type
of communication I was sending. I determined that there were three
possible channels. I could easily tell that channel three (3) was for
catastrophic errors on the server side. But it was not clear what the
difference between channel 1 and channel 2 were. Because channel 2 was
the one that appeared to be read and parsed in some manner, I assumed
that this was the "important" data channel and tried sending my data on
that channel.
I was confused and frustrated when it appeared that git-archive treated
data coming from my --exec'd git-upload-archive replacement differently
than it did when receiving data from the real git-upload-archive.
Eventually I figured out that channel 1 was for data, channel 2 was for
non-fatal messages, and channel 3 was for fatal error communications.
Having comments in sidechannel.h would have helped. But constants or
macros would have helped as well and makes the code that uses them more
clear.
Ivan
[PATCH 1/3] add constants for sideband communication channels
[PATCH 2/3] switch sideband communication to use constants
[PATCH 3/3] use SIDEBAND_*_ERROR constants in pack protocol
builtin/fetch-pack.c | 2 +-
builtin/receive-pack.c | 6 +++---
builtin/send-pack.c | 4 ++--
builtin/upload-archive.c | 6 +++---
sideband.c | 6 +++---
sideband.h | 6 +++++-
upload-pack.c | 22 +++++++++++-----------
7 files changed, 28 insertions(+), 24 deletions(-)
next reply other threads:[~2011-12-13 18:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 18:28 iheffner [this message]
2011-12-13 18:28 ` [PATCH 1/3] add constants for sideband communication channels iheffner
2011-12-13 18:28 ` [PATCH 2/3] switch sideband communication to use constants iheffner
2011-12-13 18:28 ` [PATCH 3/3] use SIDEBAND_*_ERROR constants in pack protocol iheffner
2011-12-14 4:56 ` [PATCH 0/3] use constants for sideband communication channels Junio C Hamano
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=1323800931-37123-1-git-send-email-iheffner@gmail.com \
--to=iheffner@gmail.com \
--cc=cxreg@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).