All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Guillaume Pages <guillaume.pages@ensimag.grenoble-inp.fr>
Cc: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	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: Fri, 05 Jun 2015 10:11:12 -0700	[thread overview]
Message-ID: <xmqqpp5arsgf.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <261867654.193546.1433522151490.JavaMail.zimbra@ensimag.grenoble-inp.fr> (Guillaume Pages's message of "Fri, 5 Jun 2015 18:35:51 +0200 (CEST)")

Guillaume Pages <guillaume.pages@ensimag.grenoble-inp.fr> writes:

> I felt that was not the right way to do so. What do you think of a
> function like that:
>
> /*
>  * Puts nb_commands commands from filename in lines,
>  * returns the total number of commands in the file
>  * ignores comments and empty lines
>  * lines needs to be at least of size nb_commands
>  * part: 0 get last commands
>  * 	 1 get first commands
>  */
>
> int get_commands(char *filename, int nb_commands, char **lines, int part)
>
> Maybe part is not the best word to choose to take the beginning or the end
> of the file. I also hesitate about adding a parameter to ignore or not the 
> comments.

If I were doing the caller of these two functions, then instead of
adding these specialized helpers, I'd probably structure that caller
this way:

	struct strbuf buf = STRBUF_INIT;
	struct string_list have_done = STRING_LIST_INIT_DUP;
	struct string_list yet_to_do = STRING_LIST_INIT_DUP;
	int have_done_nr, yet_to_do_nr;

	strbuf_read_file(&buf, ".../done", 0);
	stripspace(&buf, 1);
        have_done_nr = string_list_split(&have_done, buf.buf, '\n', -1);
	strbuf_release(&buf);

	strbuf_read_file(&buf, ".../todo", 0);
	stripspace(&buf, 1);
        yet_to_do_nr = string_list_split(&yet_to_do, buf.buf, '\n', -1);
	strbuf_release(&buf);

Then have_done.items[have_done_nr - 1].string would be the last one
that we have replayed, and yet_to_do.items[0].string would be the
next one we are going to replay.

  reply	other threads:[~2015-06-05 17:11 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
2015-06-04 17:19     ` Junio C Hamano
2015-06-05 16:35       ` Guillaume Pages
2015-06-05 17:11         ` Junio C Hamano [this message]
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=xmqqpp5arsgf.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=antoine.delaite@ensimag.grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=guillaume.pages@ensimag.grenoble-inp.fr \
    --cc=louis--alexandre.stuber@ensimag.grenoble-inp.fr \
    --cc=remi.galan-alfonso@ensimag.grenoble-inp.fr \
    --cc=remi.lespinet@ensimag.grenoble-inp.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.