git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git sideband hook output

From
Jeff King <peff@peff.net>
Date
Jun 12, 2010, 04:07 UTC
Message-ID
<20100612040717.GA9419@coredump.intra.peff.net>
In-Reply-To
<7v631pgm9d.fsf@alter.siamese.dyndns.org>
On Fri, Jun 11, 2010 at 04:52:46PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> 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;
Previous: Junio C HamanoNext: A Large Angry SCM
Message 13 of 17 in “Git sideband hook output”
  1. Scott ChaconJun 8, 2010
  2. Shawn O. PearceJun 8, 2010
  3. Peter KjellerstedtJun 9, 2010
  4. Nicolas PitreJun 9, 2010
  5. Peter KjellerstedtJun 10, 2010
  6. Nicolas PitreJun 10, 2010
  7. Shawn O. PearceJun 10, 2010
  8. Scott ChaconJun 10, 2010
  9. PJ HyettJun 11, 2010
  10. Wincent ColaiutaJun 11, 2010
  11. Erik Faye-LundJun 11, 2010
  12. Junio C HamanoJun 11, 2010
  13. Jeff KingJun 12, 2010
  14. A Large Angry SCMJun 11, 2010
  15. Ævar Arnfjörð BjarmasonJun 11, 2010
  16. A Large Angry SCMJun 11, 2010
  17. Johannes SixtJun 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.