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

Re: [RFC] Indicate that Git waits for user input via editor

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 16, 2017, 05:37 UTC
Message-ID
<xmqq375ewzqk.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqq8tf7yxzn.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> I wonder if we can do something like
> ...
> to tentatively give a message without permanently wasting the
> vertical space.

Learning from 13e4760a ("recv_sideband: Do not use ANSI escape sequence on dumb terminals.", 2008-01-08), I think the above should be more like this:

	git_spawn_editor()
	{
		static const char *finish;
		if (!finish) {
			const char ANSI_FINISH[] = "\r\033[K";
			const char DUMB_FINISH[] = "done.\n";
			char *term = getenv("TERM");
			if (term && strcmp(term, "dumb"))
				finish = ANSI_FINISH;
			else
				finish = DUMB_FINISH;
		}
		/* notice the lack of terminating LF */
		fprintf(stderr, "Launched your editor, waiting...");
		fflush(stderr);
		if (!run_command(... spawn the editor ...))
			fputs(finish, stderr);
		else
			fprintf(stderr, "failed (%s)\n", strerror(errno));
		fflush(stderr);
	}
Previous: Stefan BellerNext: Junio C Hamano
Message 9 of 16 in “[RFC] Indicate that Git waits for user input via editor”
  1. Lars SchneiderNov 15, 2017
  2. Stefan BellerNov 15, 2017
  3. Lars SchneiderNov 15, 2017
  4. Stefan BellerNov 15, 2017
  5. Junio C HamanoNov 15, 2017
  6. Stefan BellerNov 16, 2017
  7. Junio C HamanoNov 16, 2017
  8. Stefan BellerNov 16, 2017
  9. Junio C HamanoNov 16, 2017
  10. launch_editor(): indicate that Git waits for user inputJunio C Hamano, Nov 16, 2017
  11. Lars SchneiderNov 16, 2017
  12. Junio C HamanoNov 16, 2017
  13. Lars SchneiderNov 16, 2017
  14. Junio C HamanoNov 17, 2017
  15. Kaartic SivaraamNov 18, 2017
  16. Junio C HamanoNov 19, 2017

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.