git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Dmitry Ivankov <divanorama@gmail.com>
Cc: git@vger.kernel.org, David Barr <davidbarr@google.com>
Subject: Re: [PATCH svn-fe 5/7] Fix vcs-svn/fast_export reinit bugs
Date: Mon, 20 Jun 2011 05:12:55 -0500	[thread overview]
Message-ID: <20110620101254.GG28282@elie> (raw)
In-Reply-To: <1308558173-29672-5-git-send-email-divanorama@gmail.com>

Hi,

Dmitry Ivankov wrote:

> first_commit_done was not set in _init, but it
> is needed if fast_export_ is used/_init-ed twice.

Thanks, good catch.  I wonder if it's possible to detect this kind of
thing automatically --- maybe it would make sense for test-svn-fe to
learn to apply two dumps in sequence so this code could be exercised.

> Same thing for the branch_name.

This one should be squashed with the previous patch for easier review
imho.  New readers never have to know the details of early mistakes.

>
> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
> ---
>  vcs-svn/fast_export.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
> index 8b14b74..6a4360f 100644
> --- a/vcs-svn/fast_export.c
> +++ b/vcs-svn/fast_export.c
> @@ -32,6 +32,8 @@ static int init_postimage(void)
>  
>  void fast_export_init(int fd, const char* branch)
>  {
> +	first_commit_done = 0;
> +	strbuf_reset(&branch_name);
>  	strbuf_addstr(&branch_name, branch);
>  	if (buffer_fdinit(&report_buffer, fd))
>  		die_errno("cannot read from file descriptor %d", fd);
> @@ -45,7 +47,9 @@ void fast_export_deinit(void)
>  
>  void fast_export_reset(void)
>  {
> +	first_commit_done = 0;

I don't think this is needed --- fast_export_reset is called when we
are about to exit.  Maybe the vcs-svn::*_reset functions should be
renamed to foo_free or something similar to avoid confusion
(especially when comparing to strbuf_reset).

>  	buffer_reset(&report_buffer);
> +	strbuf_reset(&branch_name);
>  }
>  
>  void fast_export_delete(const char *path)
> -- 
> 1.7.3.4
> 

      parent reply	other threads:[~2011-06-20 10:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1308558173-29672-1-git-send-email-divanorama@gmail.com>
2011-06-20  9:31 ` [PATCH svn-fe 1/7] Remove redundant buffer_fdinit calls Jonathan Nieder
     [not found] ` <1308558173-29672-5-git-send-email-divanorama@gmail.com>
2011-06-20 10:12   ` Jonathan Nieder [this message]

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=20110620101254.GG28282@elie \
    --to=jrnieder@gmail.com \
    --cc=davidbarr@google.com \
    --cc=divanorama@gmail.com \
    --cc=git@vger.kernel.org \
    /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 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).