# RE: [PATCH v6 15/16] remote-svn: add marks-file regeneration

1 messages from 2012-08-25 to 2012-08-25. Participants: Joachim Schmitz.
Thread: https://gitlist.dev/t/31359

## Joachim Schmitz, 2012-08-25 18:55

Subject: RE: [PATCH v6 15/16] remote-svn: add marks-file regeneration
Message-ID: <002401cd82f3$24a465f0$6ded31d0$@schmitz-digital.de>
URL: https://gitlist.dev/e/002401cd82f3%2424a465f0%246ded31d0%24%40schmitz-digital.de

```
> From: Joachim Schmitz [mailto:jojo@schmitz-digital.de]
> Sent: Saturday, August 25, 2012 5:55 PM
> To: 'florian.achleitner.2.6.31@gmail.com'
> Cc: git@vger.kernel.org
> Subject: Re: [PATCH v6 15/16] remote-svn: add marks-file regeneration
> 
> "Florian Achleitner" <florian.achleitner.2.6.31@gmail.com> schrieb im Newsbeitrag news:<1345662961-9587-16-git-send-email-
> florian.achleitner.2.6.31@gmail.com>...
> > fast-import mark files are stored outside the object database and are
> > therefore not fetched and can be lost somehow else.  marks provide a
> > svn revision --> git sha1 mapping, while the notes that are attached
> > to each commit when it is imported provide a git sha1 --> svn revision
> > mapping.
> >
> > If the marks file is not available or not plausible, regenerate it by
> > walking through the notes tree.  , i.e.  The plausibility check tests
> > if the highest revision in the marks file matches the revision of the
> > top ref. It doesn't ensure that the mark file is completely correct.
> > This could only be done with an effort equal to unconditional
> > regeneration.
> >
> > Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
> > Signed-off-by: Junio C Hamano <gitster@pobox.com>
> > ---
> >  remote-testsvn.c |   68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 68 insertions(+)
> >
> > diff --git a/remote-testsvn.c b/remote-testsvn.c
> > index e90d221..09dc304 100644
> > --- a/remote-testsvn.c
> > +++ b/remote-testsvn.c
> ...
> > +static void check_or_regenerate_marks(int latestrev) {
> > +	FILE *marksfile;
> > +	char *line = NULL;
> > +	size_t linelen = 0;
> > +	struct strbuf sb = STRBUF_INIT;
> > +	int found = 0;
> > +
> > +	if (latestrev < 1)
> > +		return;
> > +
> > +	init_notes(NULL, notes_ref, NULL, 0);
> > +	marksfile = fopen(marksfilename, "r");
> > +	if (!marksfile) {
> > +		regenerate_marks();
> > +		marksfile = fopen(marksfilename, "r");
> > +		if (!marksfile)
> > +			die_errno("cannot read marks file %s!", marksfilename);
> > +		fclose(marksfile);
> > +	} else {
> > +		strbuf_addf(&sb, ":%d ", latestrev);
> > +		while (getline(&line, &linelen, marksfile) != -1) {
> 
> getline() is not available to anybody, e.g. it is not in HP NonStop.

I'd like to confirm that Ramsey's patch works for me too, so I second his request.
(Subject: [PATCH 1/3] remote-testsvn.c: Avoid the getline() GNU extension function)

Bye, Jojo

```
