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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guillaume Pagès <guillaume.pages@xxxxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]