git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/4] status: give more information during rebase
@ 2015-07-06 20:56 Matthieu Moy
  2015-07-06 20:56 ` [PATCH v6 1/4] status: factor two rebase-related messages together Matthieu Moy
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Matthieu Moy @ 2015-07-06 20:56 UTC (permalink / raw)
  To: gitster
  Cc: git, remi.lespinet, guillaume.pages, louis--alexandre.stuber,
	antoine.delaite, Matthieu Moy

This is almost identical to v5. I turned git_path(var) into
git_path("%s", var) as Junio noticed, but I still prefer my version on
the other points discussed.

Guillaume Pagès (4):
  status: factor two rebase-related messages together
  status: differentiate interactive from non-interactive rebases
  status: give more information during rebase -i
  status: add new tests for status during rebase -i

 t/t7512-status-help.sh | 226 ++++++++++++++++++++++++++++++++++++++++++++++---
 wt-status.c            | 151 +++++++++++++++++++++++++++++----
 2 files changed, 346 insertions(+), 31 deletions(-)

-- 
2.5.0.rc0.7.ge1edd74.dirty

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH v5 3/4] status: give more information during rebase -i
@ 2015-07-01 21:06 Matthieu Moy
  2015-07-01 21:08 ` [PATCH v6 1/4] status: factor two rebase-related messages together Matthieu Moy
  0 siblings, 1 reply; 6+ messages in thread
From: Matthieu Moy @ 2015-07-01 21:06 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, remi.lespinet, guillaume.pages, louis--alexandre.stuber,
	antoine.delaite

Junio C Hamano <gitster@pobox.com> writes:

> Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
>> +		strbuf_trim(split[1]);
>> +		if (!get_sha1(split[1]->buf, sha1)) {
>> +			abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
>> +			strbuf_reset(split[1]);
>> +			strbuf_addf(split[1], "%s ", abbrev);
>> +		}
>
> ... else?
>
> That is, "we thought there would be a full SHA-1, but it turns out
> that there wasn't, so we keep split[1] as-is" would need to add the
> space back, no?

Right.

> Perhaps be more strict and do this instead (without leading
> strbuf_trim):
>
> 	if (!get_sha1_hex(split[1]->buf, sha1) &&
> 	    !strcmp(split[1]->buf + 40, " ") {
> 		replace split[1] with "%s " abbrev
> 	}

Actually, we can do simpler: we still have the original line available,
so if we don't find a sha1, we can just keep it. By just letting the few
lines after the if enter the if, it just works:

		strbuf_trim(split[1]);
		if (!get_sha1(split[1]->buf, sha1)) {
			abbrev = find_unique_abbrev(sha1, DEFAULT_ABBREV);
			strbuf_reset(split[1]);
			strbuf_addf(split[1], "%s ", abbrev);
			strbuf_reset(line);
			for (i = 0; split[i]; i++)
				strbuf_addf(line, "%s", split[i]->buf);
		}

>         while (!strbuf_getline(&line, f, '\n')) {
>                 if (line.len && line.len[0] == comment_line_char)
>                         continue;
>                 strbuf_rtrim(&line);
>                 if (!line.len)
>                         continue;
>                 abbrev_sha1_in_line(&line);
>                 string_list_append(lines, line.buf);
>         }

I took this (modulo s/line.len[0]/line.buf[0]/, and s/rtrim/trim/ to be
robust to leading whitespace (not really important, but doesn't harm).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-06 20:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06 20:56 [PATCH v6 0/4] status: give more information during rebase Matthieu Moy
2015-07-06 20:56 ` [PATCH v6 1/4] status: factor two rebase-related messages together Matthieu Moy
2015-07-06 20:56 ` [PATCH v6 2/4] status: differentiate interactive from non-interactive rebases Matthieu Moy
2015-07-06 20:56 ` [PATCH v6 3/4] status: give more information during rebase -i Matthieu Moy
2015-07-06 20:56 ` [PATCH v6 4/4] status: add new tests for status " Matthieu Moy
  -- strict thread matches above, loose matches on Subject: below --
2015-07-01 21:06 [PATCH v5 3/4] status: give more information " Matthieu Moy
2015-07-01 21:08 ` [PATCH v6 1/4] status: factor two rebase-related messages together Matthieu Moy
2015-07-01 21:08   ` [PATCH v6 2/4] status: differentiate interactive from non-interactive rebases Matthieu Moy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).