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

Re: git-svn 1.5.3 does not understand grafts?

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 8, 2007, 19:53 UTC
Message-ID
<7vfy1pyluy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<045501c7f23f$c359c450$5267a8c0@Jocke>
"Joakim Tjernlund" <joakim.tjernlund@transmode.se> writes:
> hmm, I think git-cat-file is to blame.
> git-cat-file commit da783cce390ce013b19f1d308ea6813269c6a6b5 does
> not list list any parent...

The plumbing cat-file does not deal with grafts and this is deliberate. Otherwise you would not be able to find the true set of parents when you'd want to.

So do not blame cat-file, but blame the Porcelain that uses cat-file to read a commit object, without annotating what it read with what is in grafts, in this case your command line experiment ;-).

The log family of commands and rev-list plumbing while traversing commit ancestry chain do take grafts into account.

One caveat is pretty=raw output format shows true parents without grafts on "parent " header line, while the "commit " fake header prepended in the output for each commit shows the parents that takes into account.

To illustrate, if you forge the history and say the parent of 1ddea77 is 5da1606 (when the true parent is 820eca68) with grafts mechanism, here is what happens:

    $ echo '1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755' >.git/info/grafts
    $ git show -s --pretty=raw --parents 1ddea77
    commit 1ddea77e449ef28d8a7c74521af21121ab01abc0 5da1606d0bf5b970fadfa0ca91618a1e871f6755
    tree e9e61bc801438062978ff47b0963c536ed1e51a9
    parent 820eca68c2577d7499d203d7f4f7ae479b577683
    author Nick Hengeveld <nickh@reactrix.com> 1127757131 -0700
    committer Junio C Hamano <junkio@cox.net> 1127805558 -0700
        [PATCH] Return CURL error message when object transfer fails
        Return CURL error message when object transfer fails
        ...
    $ git-cat-file commit 1ddea77
    tree e9e61bc801438062978ff47b0963c536ed1e51a9
    parent 820eca68c2577d7499d203d7f4f7ae479b577683
    author Nick Hengeveld <nickh@reactrix.com> 1127757131 -0700
    committer Junio C Hamano <junkio@cox.net> 1127805558 -0700
    [PATCH] Return CURL error message when object transfer fails
    Return CURL error message when object transfer fails
    ...
Previous: Joakim TjernlundNext: Eric Wong
Message 7 of 8 in “git-svn 1.5.3 does not understand grafts?”
  1. Joakim TjernlundSep 7, 2007
  2. Joakim TjernlundSep 7, 2007
  3. Joakim TjernlundSep 7, 2007
  4. Eric WongSep 8, 2007
  5. Joakim TjernlundSep 8, 2007
  6. Joakim TjernlundSep 8, 2007
  7. Junio C HamanoSep 8, 2007
  8. git-svn: understand grafts when doing dcommitEric Wong, Sep 8, 2007

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.