{"thread":{"id":"29453","subject":"commit/from command in git-fast-import","startedAt":"2012-01-27T12:48:37Z","lastAt":"2012-01-30T15:35:54Z","messageCount":6,"participants":["Mike Hommey","David Barr","Jonathan Nieder","Sverre Rabbelier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"183186","messageId":"20120127124837.GA24084@glandium.org","threadId":"29453","inReplyTo":null,"subject":"commit/from command in git-fast-import","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2012-01-27T12:48:37Z","receivedAt":"2012-01-27T12:48:37Z","isPatch":false,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"Hi,\n\nI'm trying to make sense of the git fast-import manual page. This is\nwhat it reads, as of git 1.7.8.3, from Debian unstable:\n\n  Omitting the from command in the first commit of a new branch will\n  cause fast-import to create that commit with no ancestor. This\n  tends to be desired only for the initial commit of a project. If\n  the frontend creates all files from scratch when making a new\n  branch, a merge command may be used instead of from to start the\n  commit with an empty tree. Omitting the from command on existing\n  branches is usually desired, as the current commit on that branch\n  is automatically assumed to be the first ancestor of the new\n  commit.\n\nWhen I do create a commit on a given branch with a stream like:\n  commit refs/heads/branch\n  author ...\n  committer ...\n  data <<EOF\n  Commit message\n  EOF\n  deleteall\n\nAll I get is this warning:\n  warning: Not updating refs/heads/branch (new tip new_sha1\ndoes not contain old_sha1)\n\nAnd the branch only has one commit, which is the one I just created.\nOn the other hand, if I add a \"from\" instruction in the above stream,\nI have the expected branch history.\n\nArguably, this may be related to my use of deleteall, but nothing in the\ndeleteall description suggests this would happen.\n\nIs it an expected behaviour and a lack of proper documentation, or is it\na bug in git fast-import ?\n\nMike\n"},{"id":"183187","messageId":"CAFfmPPPYc=9BdwuE+ANiHKrFk+_7aXDgnMv3fHxVmF0ttZu8bA@mail.gmail.com","threadId":"29453","inReplyTo":"20120127124837.GA24084@glandium.org","subject":"Re: commit/from command in git-fast-import","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-01-27T14:00:17Z","receivedAt":"2012-01-27T14:00:17Z","isPatch":false,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:\n> When I do create a commit on a given branch with a stream like:\n>  commit refs/heads/branch\n>  author ...\n>  committer ...\n>  data <<EOF\n>  Commit message\n>  EOF\n>  deleteall\n>\n> All I get is this warning:\n>  warning: Not updating refs/heads/branch (new tip new_sha1\n> does not contain old_sha1)\n>\n> And the branch only has one commit, which is the one I just created.\n> On the other hand, if I add a \"from\" instruction in the above stream,\n> I have the expected branch history.\n\nThis is precisely the expected behavior.\nIf 'from' is omitted, the resulting commit has no preceding history.\nOn the other hand, what you want is to specify the parent so that\nthere is a continuation of history.\n\nI hope this helps.\n--\nDavid Barr\n"},{"id":"183189","messageId":"20120127140808.GA31535@glandium.org","threadId":"29453","inReplyTo":"CAFfmPPPYc=9BdwuE+ANiHKrFk+_7aXDgnMv3fHxVmF0ttZu8bA@mail.gmail.com","subject":"Re: commit/from command in git-fast-import","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2012-01-27T14:08:08Z","receivedAt":"2012-01-27T14:08:08Z","isPatch":false,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Sat, Jan 28, 2012 at 01:00:17AM +1100, David Barr wrote:\n> On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:\n> > When I do create a commit on a given branch with a stream like:\n> >  commit refs/heads/branch\n> >  author ...\n> >  committer ...\n> >  data <<EOF\n> >  Commit message\n> >  EOF\n> >  deleteall\n> >\n> > All I get is this warning:\n> >  warning: Not updating refs/heads/branch (new tip new_sha1\n> > does not contain old_sha1)\n> >\n> > And the branch only has one commit, which is the one I just created.\n> > On the other hand, if I add a \"from\" instruction in the above stream,\n> > I have the expected branch history.\n> \n> This is precisely the expected behavior.\n> If 'from' is omitted, the resulting commit has no preceding history.\n> On the other hand, what you want is to specify the parent so that\n> there is a continuation of history.\n\nThis is however not what the manpage suggests in what I quoted in my\nmessage:\n  Omitting the from command on existing branches is usually desired, as\n  the current commit on that branch is automatically assumed to be the\n  first ancestor of the new commit.\n\nMike\n"},{"id":"183199","messageId":"CAFfmPPM_xqZoMd391UdqRtK5bgW5V2z9Mg=8LYLA7ZVZQGR3Mg@mail.gmail.com","threadId":"29453","inReplyTo":"20120127144702.GA6693@glandium.org","subject":"Re: commit/from command in git-fast-import","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-01-27T20:56:02Z","receivedAt":"2012-01-27T20:56:02Z","isPatch":false,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"On Sat, Jan 28, 2012 at 1:47 AM, Mike Hommey <mh@glandium.org> wrote:\n> On Sat, Jan 28, 2012 at 01:15:34AM +1100, David Barr wrote:\n>> On Sat, Jan 28, 2012 at 1:08 AM, Mike Hommey <mh@glandium.org> wrote:\n>> > On Sat, Jan 28, 2012 at 01:00:17AM +1100, David Barr wrote:\n>> >> On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:\n>> >> > When I do create a commit on a given branch with a stream like:\n>> >> >  commit refs/heads/branch\n>> >> >  author ...\n>> >> >  committer ...\n>> >> >  data <<EOF\n>> >> >  Commit message\n>> >> >  EOF\n>> >> >  deleteall\n>> >> >\n>> >> > All I get is this warning:\n>> >> >  warning: Not updating refs/heads/branch (new tip new_sha1\n>> >> > does not contain old_sha1)\n>> >> >\n>> >> > And the branch only has one commit, which is the one I just created.\n>> >> > On the other hand, if I add a \"from\" instruction in the above stream,\n>> >> > I have the expected branch history.\n>> >>\n>> >> This is precisely the expected behavior.\n>> >> If 'from' is omitted, the resulting commit has no preceding history.\n>> >> On the other hand, what you want is to specify the parent so that\n>> >> there is a continuation of history.\n>> >\n>> > This is however not what the manpage suggests in what I quoted in my\n>> > message:\n>> >  Omitting the from command on existing branches is usually desired, as\n>> >  the current commit on that branch is automatically assumed to be the\n>> >  first ancestor of the new commit.\n>> >\n>> > Mike\n>>\n>> Oh, right. I guess I wasn't paying enough attention, sorry.\n>> That does sound like a bug then. Is it reproducible in a new repo?\n>> eg:\n>>   git init foo && cd foo && touch bar && git add -A && git commit -m \"baz\"\n>>   git fast-import < ../fast-import-regression.txt\n>\n> It is.\n\nI accidentally took this thread off-list.\nLooks like we have a real fast-import bug, in Debian Unstable at least.\n--\nDavid Barr\n"},{"id":"183200","messageId":"20120127210936.GC3124@burratino","threadId":"29453","inReplyTo":"CAFfmPPM_xqZoMd391UdqRtK5bgW5V2z9Mg=8LYLA7ZVZQGR3Mg@mail.gmail.com","subject":"Re: commit/from command in git-fast-import","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-01-27T21:09:36Z","receivedAt":"2012-01-27T21:09:36Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"David Barr wrote:\n>>> On Sat, Jan 28, 2012 at 1:08 AM, Mike Hommey <mh@glandium.org> wrote:\n\n>>>> This is however not what the manpage suggests in what I quoted in my\n>>>> message:\n>>>>  Omitting the from command on existing branches is usually desired, as\n>>>>  the current commit on that branch is automatically assumed to be the\n>>>>  first ancestor of the new commit.\n[...]\n> Looks like we have a real fast-import bug, in Debian Unstable at least.\n\nYep, this is a real fast-import documentation bug.  The manual says:\n\n\tOmitting the from command in the first commit of a new branch\n\twill cause fast-import to create that commit with no ancestor.\n\tThis tends to be desired only for the initial commit of a\n\tproject.\n[...]\n\tThe special case of restarting an incremental import from the\n\tcurrent branch value should be written as:\n\n\t\tfrom refs/heads/branch^0\n\nThe unfortunate term here is \"existing branches\", which seems to have\nbeen intended to refer to refs that have already been populated in\nthis fast-import stream by a \"commit\" or \"reset\" command, rather than\nany old ref that already exists in the repository.\n\nIn other words, instead of \"existing branch\", the manual should say\nsomething along the lines of \"branch already in fast-import's internal\nbranch table\".\n\nHere's a sketch.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-fast-import.txt |   14 ++++++++------\n 1 files changed, 8 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt\nindex ec6ef311..28a317ff 100644\n--- a/Documentation/git-fast-import.txt\n+++ b/Documentation/git-fast-import.txt\n@@ -306,9 +306,9 @@ and control the current import process.  More detailed discussion\n (with examples) of each command follows later.\n \n `commit`::\n-\tCreates a new branch or updates an existing branch by\n-\tcreating a new commit and updating the branch to point at\n-\tthe newly created commit.\n+\tCreates a new branch or updates a branch by creating a new\n+\tcommit and updating the branch to point at the newly created\n+\tcommit.\n \n `tag`::\n \tCreates an annotated tag object from an existing commit or\n@@ -317,7 +317,7 @@ and control the current import process.  More detailed discussion\n \tin time.\n \n `reset`::\n-\tReset an existing branch (or a new branch) to a specific\n+\tReset an existing branch or a new branch to a specific\n \trevision.  This command must be used to change a branch to\n \ta specific revision without making a commit on it.\n \n@@ -439,13 +439,15 @@ The `from` command is used to specify the commit to initialize\n this branch from.  This revision will be the first ancestor of the\n new commit.\n \n-Omitting the `from` command in the first commit of a new branch\n+Omitting the `from` command in the first commit of a branch that\n+has not been created previously with a `commit` or `reset` command\n will cause fast-import to create that commit with no ancestor. This\n tends to be desired only for the initial commit of a project.\n If the frontend creates all files from scratch when making a new\n branch, a `merge` command may be used instead of `from` to start\n the commit with an empty tree.\n-Omitting the `from` command on existing branches is usually desired,\n+Omitting the `from` command on branches that have already been\n+initialized in the same stream is usually desired,\n as the current commit on that branch is automatically assumed to\n be the first ancestor of the new commit.\n \n-- \n1.7.9.rc2\n"},{"id":"183329","messageId":"CAGdFq_jG6=mQvQ9c3gxRy1p0Cvy-eJ7k37SNoZqT5-Dx5HW0Ew@mail.gmail.com","threadId":"29453","inReplyTo":"20120127210936.GC3124@burratino","subject":"Re: commit/from command in git-fast-import","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2012-01-30T15:35:54Z","receivedAt":"2012-01-30T15:35:54Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"On Fri, Jan 27, 2012 at 15:09, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> The unfortunate term here is \"existing branches\", which seems to have\n> been intended to refer to refs that have already been populated in\n> this fast-import stream by a \"commit\" or \"reset\" command, rather than\n> any old ref that already exists in the repository.\n>\n> In other words, instead of \"existing branch\", the manual should say\n> something along the lines of \"branch already in fast-import's internal\n> branch table\".\n\nLooks sane.\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}