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

Re: [PATCH 3/4] status: give more information during rebase -i

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 4, 2015, 08:06 UTC
Message-ID
<vpqfv67zylq.fsf@anie.imag.fr>
In-Reply-To
<1433368825-24617-3-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr>
Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:
> +  (use git rebase --edit-todo to view and edit)
You're still missing double-quotes around "git rebase --edit-todo".
Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:
> +Last command(s) done (1 command(s) done):

Can't we just have "1 command"/"2 commands" instead of this (s). It's particularly bad since it is already within parenthesis.

See the doc for Q_() in po/README and http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html for more details.

Show 55 quoted lines
> +void get_two_last_lines(char *filename, int *numlines, char **lines)
> +{
> +	struct strbuf buf = STRBUF_INIT;
> +	FILE *fp;
> +
> +	*numlines = 0;
> +	fp = fopen(git_path("%s", filename), "r");
> +	if (!fp) {
> +		strbuf_release(&buf);
> +		return;
> +	}
> +	while (strbuf_getline(&buf, fp, '\n') != EOF) {
> +		(*numlines)++;
> +		lines[0] = lines[1];
> +		lines[1] = strbuf_detach(&buf, NULL);
> +	}
> +	fclose(fp);
> +}
> +
> +void get_two_first_lines(char *filename, int *numlines, char **lines)
> +{
> +	struct strbuf buf = STRBUF_INIT;;
> +	char *line;
> +	FILE *fp;
> +
> +
> +	*numlines = 0;
> +	fp = fopen(git_path("%s", filename), "r");
> +	if (!fp) {
> +		strbuf_release(&buf);
> +		return;
> +	}
> +	while (strbuf_getline(&buf, fp, '\n') != EOF) {
> +		stripspace(&buf, 1);
> +		line = strbuf_detach(&buf, NULL);
> +		if (strcmp(line, "") == 0)
> +			continue;
> +		if (*numlines < 2)
> +			lines[*numlines] = line;
> +		(*numlines)++;
> +	}
> +	fclose(fp);
> +}
> +
> +static void show_rebase_information(struct wt_status *s,
> +				    struct wt_status_state *state,
> +				    const char *color)
> +{
> +	if (state->rebase_interactive_in_progress) {
> +		int i, begin;
> +		int numlines = 0;
> +		char *lines[2];
> +		get_two_last_lines("rebase-merge/done", &numlines, lines);
> +		if (numlines == 0)
> +			status_printf_ln(s,color,_("No command done."));
space after comma.

You may want to play with clang-format/clang-format-diff to have a tool tell you this instead of asking a human.

I think english people would make this plural (No commands done).
> +		else{
> +			status_printf_ln(s,color,
> +				_("Last command(s) done (%d command(s) done):"),
> +				numlines);
Q_() ?
Show 7 quoted lines
> +			begin = numlines > 1? 0 : 1;
> +			for (i = begin; i < 2; i++) {
> +				status_printf_ln(s,color,"   %s",lines[i]);
> +			}
> +			if (numlines > 2 && s->hints)
> +			   status_printf_ln(s,color,
> +				_("  (see more at .git/rebase-merge/done)"));
I'd write explicitly 'in file ...' instead of 'at'.
You need to use git_path here, it may not be ".git" in some contexts.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Guillaume PagèsNext: Junio C Hamano
Message 4 of 11 in “status: factor two rebase-related messages together”
  1. 1/4 status: factor two rebase-related messages togetherGuillaume Pagès, Jun 3, 2015
  2. 2/4 status: differentiate interactive from non-interactive rebasesGuillaume Pagès, Jun 3, 2015
  3. 3/4 status: give more information during rebase -iGuillaume Pagès, Jun 3, 2015
  4. Matthieu MoyJun 4, 2015
  5. Junio C HamanoJun 4, 2015
  6. Guillaume PagesJun 5, 2015
  7. Junio C HamanoJun 5, 2015
  8. 4/4 status: add new tests for status during rebase -iGuillaume Pagès, Jun 3, 2015
  9. Matthieu MoyJun 4, 2015
  10. Junio C HamanoJun 8, 2015
  11. Guillaume PagesJun 9, 2015

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.