git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-fast-export bug, commits emmitted in incorrect order causing parent data to be lost from commits turning essentially linear repo into "islands"

From
YOYves Orton <yves.orton@booking.com>
Date
Jun 12, 2008, 10:21 UTC
Message-ID
<1213266100.6940.207.camel@gemini>
Hi,

Ive been working with git-fast-export a bit recently and Ive hit a bug that is causing some trouble.

Essentially it seems that one of our repos git-fast-export fails to emit the proper 'from' information for several commits in the repo. These commits are emitted first without parent data even though their parents ARE emitted later.

The code responsible for skipping the parent info is in
builtin-fast-export.c around line 402:
        for (i = 0, p = commit->parents; p; p = p->next) {
                int mark = get_object_mark(&p->item->object);
                if (!mark)
                        continue;
                if (i == 0)
                        printf("from :%d\n", mark);
                else
                        printf("merge :%d\n", mark);
                i++;
        }

If i modify this loop to warn when skipping a parent I get a warning for each of the "broken" commits. Apparently because they are emitted before their parents the parents have no "mark" assigned to them (via decoration) and thus are skipped in this emit process. This would make sense for emitting a limited number of patches, but makes no sense when the --all option is used. Ive tried to investigate further but i got lost in a twisty maze of routines in revision.c, which apparently is responsible for building a list of items to emit in the correct order.

However i think it is notable that both gitk and git log seem quite able to deal with things properly, thus i find it a bit strange that fast-export would get it wrong.

Unfortunately I have no idea how to create a minimal repo that illustrates this problem.

Im currently on git version 1.5.6.rc2.29.g3ba9 (latest version from last night), however this problem shows itself on 1.5.4.3 as well, as well as an earlier version whose exact number i no longer know.

Other evidence that might be useful
	git log --pretty=format:"%H:%P" 

shows that every commit but one (the root) has parents. And gitk renders the original repo fine. The repo can be cloned and etc, without trouble. The problem seems to be strictly related to fast-export.

Im not on list so please cc me on any replies. 

Thanks a lot! Yves

Next: Johannes Sixt
Message 1 of 7 in “git-fast-export bug, commits emmitted in incorrect order causing parent data to be lost from commits turning essentially linear repo into "islands"”
  1. Yves OrtonJun 12, 2008
  2. Johannes SixtJun 12, 2008
  3. Yves OrtonJun 12, 2008
  4. Yves OrtonJun 12, 2008
  5. Johannes SixtJun 12, 2008
  6. Michael J GruberJun 12, 2008
  7. Philippe Bruhat (BooK)Jun 12, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.