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/