# [PATCH] builtin-fast-export: Only output a single parent per line

6 messages from 2008-05-24 to 2008-05-26. Participants: Pieter de Bie, Junio C Hamano, Shawn O. Pearce.
Thread: https://gitlist.dev/t/13658

## Pieter de Bie, 2008-05-24 23:21

Subject: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <1211671313-99006-1-git-send-email-pdebie@ai.rug.nl>
URL: https://gitlist.dev/e/1211671313-99006-1-git-send-email-pdebie%40ai.rug.nl

```
According to the git-fast-import man-page, you can only put a single
committish per merge: line, like this:

  merge :10
  merge :11

However, git-fast-export puts all parents on a single line, like this:

  merge :10 :11

This may be fine with git-fast-import, but other importers based on it, like
bzr-fast-import, can't handle this.

This changes fast-export to also output a single parent per line.

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
---

I'm not sure why this was done, but it messed up my import :)
 builtin-fast-export.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index e1c5630..34acdf9 100755
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -204,10 +204,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
 			continue;
 		if (i == 0)
 			printf("from :%d\n", mark);
-		else if (i == 1)
-			printf("merge :%d", mark);
 		else
-			printf(" :%d", mark);
+			printf("merge :%d\n", mark);
 		i++;
 	}
 	if (i > 1)
-- 
1.5.5.1.541.g51dc4.dirty

```

## Junio C Hamano, 2008-05-25 01:38

Subject: Re: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <7vskw7jh7c.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vskw7jh7c.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1211671313-99006-1-git-send-email-pdebie@ai.rug.nl>

```
Pieter de Bie <pdebie@ai.rug.nl> writes:

> According to the git-fast-import man-page, you can only put a single
> committish per merge: line, like this:
>
>   merge :10
>   merge :11
>
> However, git-fast-export puts all parents on a single line, like this:
>
>   merge :10 :11
>
> This may be fine with git-fast-import,...

Is it fine for even git-fast-import?  fast-import.c: parse_merge() seems
to suggest that it also wants one parent per "merge " line.

```

## Shawn O. Pearce, 2008-05-26 01:49

Subject: Re: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <20080526014904.GZ29038@spearce.org>
URL: https://gitlist.dev/e/20080526014904.GZ29038%40spearce.org
In-Reply-To: <7vskw7jh7c.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> wrote:
> Pieter de Bie <pdebie@ai.rug.nl> writes:
> 
> > According to the git-fast-import man-page, you can only put a single
> > committish per merge: line, like this:
> >
> >   merge :10
> >   merge :11
> >
> > However, git-fast-export puts all parents on a single line, like this:
> >
> >   merge :10 :11
> >
> > This may be fine with git-fast-import,...
> 
> Is it fine for even git-fast-import?  fast-import.c: parse_merge() seems
> to suggest that it also wants one parent per "merge " line.

fast-import wants the same as bzr-fast-import; one parent per
merge line.  If git-fast-import was doing anything with multiple
per line it was probably dropping everything after the first.  :-(

This was a bug in fast-export; I'm glad Pieter has fixed it.

-- 
Shawn.

```

## Junio C Hamano, 2008-05-26 05:19

Subject: Re: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <7v7idhej6f.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v7idhej6f.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080526014904.GZ29038@spearce.org>

```
"Shawn O. Pearce" <spearce@spearce.org> writes:

> Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> Is it fine for even git-fast-import?  fast-import.c: parse_merge() seems
>> to suggest that it also wants one parent per "merge " line.
>
> fast-import wants the same as bzr-fast-import; one parent per
> merge line.  If git-fast-import was doing anything with multiple
> per line it was probably dropping everything after the first.  :-(
>
> This was a bug in fast-export; I'm glad Pieter has fixed it.

Unfortunately, t9301 does not pass with the "fix".

```

## Junio C Hamano, 2008-05-26 05:24

Subject: Re: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <7vzlqdd4ef.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzlqdd4ef.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <7v7idhej6f.fsf@gitster.siamese.dyndns.org>

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

> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
>> Junio C Hamano <gitster@pobox.com> wrote:
>> ...
>>> Is it fine for even git-fast-import?  fast-import.c: parse_merge() seems
>>> to suggest that it also wants one parent per "merge " line.
>>
>> fast-import wants the same as bzr-fast-import; one parent per
>> merge line.  If git-fast-import was doing anything with multiple
>> per line it was probably dropping everything after the first.  :-(
>>
>> This was a bug in fast-export; I'm glad Pieter has fixed it.
>
> Unfortunately, t9301 does not pass with the "fix".

Perhaps, this is needed on top?

 builtin-fast-export.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 4d28cf7..4bf5b58 100755
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -209,8 +209,6 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
 			printf("merge :%d\n", mark);
 		i++;
 	}
-	if (i > 1)
-		printf("\n");
 
 	log_tree_diff_flush(rev);
 	rev->diffopt.output_format = saved_output_format;

```

## Shawn O. Pearce, 2008-05-26 05:30

Subject: Re: [PATCH] builtin-fast-export: Only output a single parent per line
Message-ID: <20080526053020.GD30245@spearce.org>
URL: https://gitlist.dev/e/20080526053020.GD30245%40spearce.org
In-Reply-To: <7vzlqdd4ef.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> wrote:
> > Unfortunately, t9301 does not pass with the "fix".
> 
> Perhaps, this is needed on top?
> 
>  builtin-fast-export.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-fast-export.c b/builtin-fast-export.c
> index 4d28cf7..4bf5b58 100755
> --- a/builtin-fast-export.c
> +++ b/builtin-fast-export.c
> @@ -209,8 +209,6 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
>  			printf("merge :%d\n", mark);
>  		i++;
>  	}
> -	if (i > 1)
> -		printf("\n");
>  
>  	log_tree_diff_flush(rev);
>  	rev->diffopt.output_format = saved_output_format;


Yea, that looks right.  The LF shouldn't follow the last merge
command.

-- 
Shawn.

```
