Re: Git sideband hook output
From: Jeff King <hidden>
Date: 2016-06-15 22:48:57
Subsystem:
the rest · Maintainer:
Linus Torvalds
On Fri, Jun 11, 2010 at 04:52:46PM -0700, Junio C Hamano wrote:
Erik Faye-Lund [off-list ref] writes:quoted
quoted
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;