public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: "Guillaume Pagès" <guillaume.pages@ensimag•grenoble-inp.fr>
Cc: git@vger•kernel.org,
	Remi Galan <remi.galan-alfonso@ensimag•grenoble-inp.fr>,
	Remi Lespinet <remi.lespinet@ensimag•grenoble-inp.fr>,
	Louis-Alexandre Stuber 
	<louis--alexandre.stuber@ensimag•grenoble-inp.fr>,
	Antoine Delaite <antoine.delaite@ensimag•grenoble-inp.fr>
Subject: Re: [PATCH 3/4] status: give more information during rebase -i
Date: Thu, 04 Jun 2015 10:06:41 +0200	[thread overview]
Message-ID: <vpqfv67zylq.fsf@anie.imag.fr> (raw)
In-Reply-To: <1433368825-24617-3-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr> ("Guillaume \=\?iso-8859-1\?Q\?Pag\=E8s\=22's\?\= message of "Thu, 4 Jun 2015 00:00:24 +0200")

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.

> +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_() ?

> +			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/

  reply	other threads:[~2015-06-04  8:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-03 22:00 [PATCH 1/4] status: factor two rebase-related messages together Guillaume Pagès
2015-06-03 22:00 ` [PATCH 2/4] status: differentiate interactive from non-interactive rebases Guillaume Pagès
2015-06-03 22:00 ` [PATCH 3/4] status: give more information during rebase -i Guillaume Pagès
2015-06-04  8:06   ` Matthieu Moy [this message]
2015-06-04 17:19     ` Junio C Hamano
2015-06-05 16:35       ` Guillaume Pages
2015-06-05 17:11         ` Junio C Hamano
2015-06-03 22:00 ` [PATCH 4/4] status: add new tests for status " Guillaume Pagès
2015-06-04  8:11   ` Matthieu Moy
2015-06-08 22:00 ` [PATCH 1/4] status: factor two rebase-related messages together Junio C Hamano
2015-06-09  7:33   ` Guillaume Pages
  -- strict thread matches above, loose matches on Subject: below --
2015-06-08 14:55 [PATCH 3/4] status: give more information during rebase -i Guillaume Pagès
2015-06-08 16:17 ` Matthieu Moy
2015-06-08 22:11 ` Junio C Hamano
2015-06-09  8:57   ` Guillaume Pages
2015-06-09 14:42 [PATCH 1/4] status: factor two rebase-related messages together Guillaume Pagès
2015-06-09 14:42 ` [PATCH 3/4] status: give more information during rebase -i Guillaume Pagès

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=vpqfv67zylq.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=antoine.delaite@ensimag$(echo .)grenoble-inp.fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=guillaume.pages@ensimag$(echo .)grenoble-inp.fr \
    --cc=louis--alexandre.stuber@ensimag$(echo .)grenoble-inp.fr \
    --cc=remi.galan-alfonso@ensimag$(echo .)grenoble-inp.fr \
    --cc=remi.lespinet@ensimag$(echo .)grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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