git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: kusmabite@gmail.com, Wincent Colaiuta <win@wincent.com>,
	PJ Hyett <pjhyett@gmail.com>, Scott Chacon <schacon@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Peter Kjellerstedt <peter.kjellerstedt@axis.com>,
	Nicolas Pitre <nico@fluxnic.net>, git list <git@vger.kernel.org>
Subject: Re: Git sideband hook output
Date: Sat, 12 Jun 2010 00:07:17 -0400	[thread overview]
Message-ID: <20100612040717.GA9419@coredump.intra.peff.net> (raw)
In-Reply-To: <7v631pgm9d.fsf@alter.siamese.dyndns.org>

On Fri, Jun 11, 2010 at 04:52:46PM -0700, Junio C Hamano wrote:

> Erik Faye-Lund <kusmabite@googlemail.com> writes:
> 
> >> Funny, as '>>' is basically meaningless. At least 'remote:' has semantic value (ie. it indicates _where_ something is coming from).
> >
> > How about '> ', which often means "quote" (e.g in e-mails)? Would that
> > be appropriate?
> 
> Not much better, IMNSHO.  Where do people get the idea that line-noises
> are more descriptive than "remote:"?

I also find '>' ugly, but maybe it is worth quelling the bikeshed
discussion with something like the following.

diff --git a/cache.h b/cache.h
index 5e55367..c616513 100644
--- a/cache.h
+++ b/cache.h
@@ -999,6 +999,7 @@ extern int pager_use_color;
 
 extern const char *editor_program;
 extern const char *excludes_file;
+extern const char *sideband_prefix;
 
 /* base85 */
 int decode_85(char *dst, const char *line, int linelen);
diff --git a/config.c b/config.c
index 9b6b1df..22a1b04 100644
--- a/config.c
+++ b/config.c
@@ -579,6 +579,9 @@ static int git_default_core_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.sidebandprefix"))
+		return git_config_string(&sideband_prefix, var, value);
+
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
 }
diff --git a/sideband.c b/sideband.c
index d5ffa1c..be4a785 100644
--- a/sideband.c
+++ b/sideband.c
@@ -12,22 +12,27 @@
  * the remote died unexpectedly.  A flush() concludes the stream.
  */
 
-#define PREFIX "remote:"
+#define DEFAULT_PREFIX "remote:"
 
 #define ANSI_SUFFIX "\033[K"
 #define DUMB_SUFFIX "        "
 
 #define FIX_SIZE 10  /* large enough for any of the above */
 
+char *sideband_prefix = DEFAULT_PREFIX;
+
 int recv_sideband(const char *me, int in_stream, int out)
 {
-	unsigned pf = strlen(PREFIX);
+	unsigned pf = strlen(sideband_prefix);
 	unsigned sf;
 	char buf[LARGE_PACKET_MAX + 2*FIX_SIZE];
 	char *suffix, *term;
 	int skip_pf = 0;
 
-	memcpy(buf, PREFIX, pf);
+	if (pf > FIX_SIZE)
+		pf = FIX_SIZE;
+
+	memcpy(buf, sideband_prefix, pf);
 	term = getenv("TERM");
 	if (term && strcmp(term, "dumb"))
 		suffix = ANSI_SUFFIX;

  reply	other threads:[~2010-06-12  4:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 20:32 Git sideband hook output Scott Chacon
2010-06-08 21:46 ` Shawn O. Pearce
2010-06-09  8:04   ` Peter Kjellerstedt
2010-06-09 13:44     ` Nicolas Pitre
2010-06-10 12:56       ` Peter Kjellerstedt
2010-06-10 18:05         ` Nicolas Pitre
2010-06-10 18:30         ` Shawn O. Pearce
2010-06-10 18:49           ` Scott Chacon
2010-06-11 14:34             ` PJ Hyett
2010-06-11 14:45               ` Wincent Colaiuta
2010-06-11 15:11                 ` Erik Faye-Lund
2010-06-11 23:52                   ` Junio C Hamano
2010-06-12  4:07                     ` Jeff King [this message]
2010-06-11 21:54                 ` A Large Angry SCM
2010-06-11 15:18           ` Ævar Arnfjörð Bjarmason
2010-06-11 21:55             ` A Large Angry SCM
2010-06-09  6:10 ` Johannes Sixt

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=20100612040717.GA9419@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kusmabite@gmail.com \
    --cc=nico@fluxnic.net \
    --cc=peter.kjellerstedt@axis.com \
    --cc=pjhyett@gmail.com \
    --cc=schacon@gmail.com \
    --cc=spearce@spearce.org \
    --cc=win@wincent.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 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).