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

Re: git bugs

From
Ben Lynn <benlynn@gmail.com>
Date
Jun 12, 2008, 06:46 UTC
Message-ID
<832adb090806112346r12c34d2bibf822f8422b349c5@mail.gmail.com>
In-Reply-To
<20080612031723.GJ11793@spearce.org>

Thanks! I just tested it on the example I quoted before, and it works. I misunderstood the reset command. I thought it took you to some previous commit. But now I see it takes you back to before the initial commit if you don't use the "from" command.

-Ben
On Wed, Jun 11, 2008 at 8:17 PM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 46 quoted lines
> Ben Lynn <benlynn@gmail.com> wrote:
>> 1. The import/export language poorly handles distinct initial commits
>> on the same branch, because given two commits with same branch name,
>> it assumes the latter is the descendant of the former (if there are no
>> "from" commands).
>>
>> Normally this is what you want. But if your project, like git, ever
>> merges distinct initial commits, then all but the first will
>> unexpectedly gain parents, corrupting all their descendants' hashes.
> ...
>> As a workaround, I have a custom importer that knows that
>> git-fast-export omits the "from" command in initial commits. But there
>> should be a command to specify that the current commit is an initial
>> commit, allowing reliable export of projects such as git.
>
> fast-export is wrong, and is using the language wrong.  fast-import
> is correct.  Because I said so.  :-)
>
> No, seriously, fast-import came along first and can describe what
> you are referring to as the many initial root commits in git.git.
> The issue is fast-export is not generating commands to say as much.
>
> Its quite easily fixable.
>
> When we output a commit in handle_commit() we just need to reset
> the branch if we have no parents.  That simple.  This is totally
> untested, but I think it fixes it.
>
>
> diff --git a/builtin-fast-export.c b/builtin-fast-export.c
> index 1dfc01e..d0a462f 100644
> --- a/builtin-fast-export.c
> +++ b/builtin-fast-export.c
> @@ -188,6 +188,8 @@ static void handle_commit(struct commit *commit, struct rev_info *rev)
>        mark_object(&commit->object);
>        if (!is_encoding_utf8(encoding))
>                reencoded = reencode_string(message, "UTF-8", encoding);
> +       if (!commit->parents)
> +               printf("reset %s\n", (const char*)commit->util);
>        printf("commit %s\nmark :%d\n%.*s\n%.*s\ndata %u\n%s",
>               (const char *)commit->util, last_idnum,
>               (int)(author_end - author), author,
>
> --
> Shawn.
>
Previous: Shawn O. PearceNext: Johannes Schindelin
Message 34 of 35 in “git bugs”
  1. Ben LynnJun 10, 2008
  2. Daniel BarkalowJun 10, 2008
  3. Linus TorvaldsJun 10, 2008
  4. Ben LynnJun 10, 2008
  5. Linus TorvaldsJun 10, 2008
  6. Ben LynnJun 10, 2008
  7. Junio C HamanoJun 10, 2008
  8. Ben LynnJun 11, 2008
  9. Junio C HamanoJun 11, 2008
  10. Ben LynnJun 11, 2008
  11. Ben LynnJun 11, 2008
  12. Stephen R. van den BergJun 11, 2008
  13. Ben LynnJun 12, 2008
  14. Linus TorvaldsJun 11, 2008
  15. Ben LynnJun 11, 2008
  16. Linus TorvaldsJun 11, 2008
  17. Ben LynnJun 11, 2008
  18. Linus TorvaldsJun 11, 2008
  19. Ben LynnJun 11, 2008
  20. Ben LynnJun 11, 2008
  21. Linus TorvaldsJun 11, 2008
  22. Ben LynnJun 11, 2008
  23. Linus TorvaldsJun 11, 2008
  24. Ben LynnJun 11, 2008
  25. Linus TorvaldsJun 11, 2008
  26. Ben LynnJun 11, 2008
  27. Junio C HamanoJun 11, 2008
  28. Linus TorvaldsJun 11, 2008
  29. Junio C HamanoJun 12, 2008
  30. Jeff KingJun 13, 2008
  31. Junio C HamanoJun 13, 2008
  32. Jeff KingJun 14, 2008
  33. Shawn O. PearceJun 12, 2008
  34. Ben LynnJun 12, 2008
  35. Johannes SchindelinJun 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.