* commit/from command in git-fast-import
@ 2012-01-27 12:48 Mike Hommey
2012-01-27 14:00 ` David Barr
0 siblings, 1 reply; 6+ messages in thread
From: Mike Hommey @ 2012-01-27 12:48 UTC (permalink / raw)
To: git
Hi,
I'm trying to make sense of the git fast-import manual page. This is
what it reads, as of git 1.7.8.3, from Debian unstable:
Omitting the from command in the first commit of a new branch will
cause fast-import to create that commit with no ancestor. This
tends to be desired only for the initial commit of a project. If
the frontend creates all files from scratch when making a new
branch, a merge command may be used instead of from to start the
commit with an empty tree. Omitting the from command on existing
branches is usually desired, as the current commit on that branch
is automatically assumed to be the first ancestor of the new
commit.
When I do create a commit on a given branch with a stream like:
commit refs/heads/branch
author ...
committer ...
data <<EOF
Commit message
EOF
deleteall
All I get is this warning:
warning: Not updating refs/heads/branch (new tip new_sha1
does not contain old_sha1)
And the branch only has one commit, which is the one I just created.
On the other hand, if I add a "from" instruction in the above stream,
I have the expected branch history.
Arguably, this may be related to my use of deleteall, but nothing in the
deleteall description suggests this would happen.
Is it an expected behaviour and a lack of proper documentation, or is it
a bug in git fast-import ?
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: commit/from command in git-fast-import
2012-01-27 12:48 commit/from command in git-fast-import Mike Hommey
@ 2012-01-27 14:00 ` David Barr
2012-01-27 14:08 ` Mike Hommey
0 siblings, 1 reply; 6+ messages in thread
From: David Barr @ 2012-01-27 14:00 UTC (permalink / raw)
To: Mike Hommey; +Cc: git
On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:
> When I do create a commit on a given branch with a stream like:
> commit refs/heads/branch
> author ...
> committer ...
> data <<EOF
> Commit message
> EOF
> deleteall
>
> All I get is this warning:
> warning: Not updating refs/heads/branch (new tip new_sha1
> does not contain old_sha1)
>
> And the branch only has one commit, which is the one I just created.
> On the other hand, if I add a "from" instruction in the above stream,
> I have the expected branch history.
This is precisely the expected behavior.
If 'from' is omitted, the resulting commit has no preceding history.
On the other hand, what you want is to specify the parent so that
there is a continuation of history.
I hope this helps.
--
David Barr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: commit/from command in git-fast-import
2012-01-27 14:00 ` David Barr
@ 2012-01-27 14:08 ` Mike Hommey
[not found] ` <CAFfmPPN9BOp3tDetEeMjVmfFam3bgHzf=q5Am4OkTz0TqLWfbQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Mike Hommey @ 2012-01-27 14:08 UTC (permalink / raw)
To: David Barr; +Cc: git
On Sat, Jan 28, 2012 at 01:00:17AM +1100, David Barr wrote:
> On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:
> > When I do create a commit on a given branch with a stream like:
> > commit refs/heads/branch
> > author ...
> > committer ...
> > data <<EOF
> > Commit message
> > EOF
> > deleteall
> >
> > All I get is this warning:
> > warning: Not updating refs/heads/branch (new tip new_sha1
> > does not contain old_sha1)
> >
> > And the branch only has one commit, which is the one I just created.
> > On the other hand, if I add a "from" instruction in the above stream,
> > I have the expected branch history.
>
> This is precisely the expected behavior.
> If 'from' is omitted, the resulting commit has no preceding history.
> On the other hand, what you want is to specify the parent so that
> there is a continuation of history.
This is however not what the manpage suggests in what I quoted in my
message:
Omitting the from command on existing branches is usually desired, as
the current commit on that branch is automatically assumed to be the
first ancestor of the new commit.
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: commit/from command in git-fast-import
[not found] ` <20120127144702.GA6693@glandium.org>
@ 2012-01-27 20:56 ` David Barr
2012-01-27 21:09 ` Jonathan Nieder
0 siblings, 1 reply; 6+ messages in thread
From: David Barr @ 2012-01-27 20:56 UTC (permalink / raw)
To: Mike Hommey; +Cc: git, Dmitry Ivankov, Sverre Rabbelier, Jonathan Nieder
On Sat, Jan 28, 2012 at 1:47 AM, Mike Hommey <mh@glandium.org> wrote:
> On Sat, Jan 28, 2012 at 01:15:34AM +1100, David Barr wrote:
>> On Sat, Jan 28, 2012 at 1:08 AM, Mike Hommey <mh@glandium.org> wrote:
>> > On Sat, Jan 28, 2012 at 01:00:17AM +1100, David Barr wrote:
>> >> On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey <mh@glandium.org> wrote:
>> >> > When I do create a commit on a given branch with a stream like:
>> >> > commit refs/heads/branch
>> >> > author ...
>> >> > committer ...
>> >> > data <<EOF
>> >> > Commit message
>> >> > EOF
>> >> > deleteall
>> >> >
>> >> > All I get is this warning:
>> >> > warning: Not updating refs/heads/branch (new tip new_sha1
>> >> > does not contain old_sha1)
>> >> >
>> >> > And the branch only has one commit, which is the one I just created.
>> >> > On the other hand, if I add a "from" instruction in the above stream,
>> >> > I have the expected branch history.
>> >>
>> >> This is precisely the expected behavior.
>> >> If 'from' is omitted, the resulting commit has no preceding history.
>> >> On the other hand, what you want is to specify the parent so that
>> >> there is a continuation of history.
>> >
>> > This is however not what the manpage suggests in what I quoted in my
>> > message:
>> > Omitting the from command on existing branches is usually desired, as
>> > the current commit on that branch is automatically assumed to be the
>> > first ancestor of the new commit.
>> >
>> > Mike
>>
>> Oh, right. I guess I wasn't paying enough attention, sorry.
>> That does sound like a bug then. Is it reproducible in a new repo?
>> eg:
>> git init foo && cd foo && touch bar && git add -A && git commit -m "baz"
>> git fast-import < ../fast-import-regression.txt
>
> It is.
I accidentally took this thread off-list.
Looks like we have a real fast-import bug, in Debian Unstable at least.
--
David Barr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: commit/from command in git-fast-import
2012-01-27 20:56 ` David Barr
@ 2012-01-27 21:09 ` Jonathan Nieder
2012-01-30 15:35 ` Sverre Rabbelier
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Nieder @ 2012-01-27 21:09 UTC (permalink / raw)
To: David Barr; +Cc: Mike Hommey, git, Dmitry Ivankov, Sverre Rabbelier
David Barr wrote:
>>> On Sat, Jan 28, 2012 at 1:08 AM, Mike Hommey <mh@glandium.org> wrote:
>>>> This is however not what the manpage suggests in what I quoted in my
>>>> message:
>>>> Omitting the from command on existing branches is usually desired, as
>>>> the current commit on that branch is automatically assumed to be the
>>>> first ancestor of the new commit.
[...]
> Looks like we have a real fast-import bug, in Debian Unstable at least.
Yep, this is a real fast-import documentation bug. The manual says:
Omitting the from command in the first commit of a new branch
will cause fast-import to create that commit with no ancestor.
This tends to be desired only for the initial commit of a
project.
[...]
The special case of restarting an incremental import from the
current branch value should be written as:
from refs/heads/branch^0
The unfortunate term here is "existing branches", which seems to have
been intended to refer to refs that have already been populated in
this fast-import stream by a "commit" or "reset" command, rather than
any old ref that already exists in the repository.
In other words, instead of "existing branch", the manual should say
something along the lines of "branch already in fast-import's internal
branch table".
Here's a sketch.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Documentation/git-fast-import.txt | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index ec6ef311..28a317ff 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -306,9 +306,9 @@ and control the current import process. More detailed discussion
(with examples) of each command follows later.
`commit`::
- Creates a new branch or updates an existing branch by
- creating a new commit and updating the branch to point at
- the newly created commit.
+ Creates a new branch or updates a branch by creating a new
+ commit and updating the branch to point at the newly created
+ commit.
`tag`::
Creates an annotated tag object from an existing commit or
@@ -317,7 +317,7 @@ and control the current import process. More detailed discussion
in time.
`reset`::
- Reset an existing branch (or a new branch) to a specific
+ Reset an existing branch or a new branch to a specific
revision. This command must be used to change a branch to
a specific revision without making a commit on it.
@@ -439,13 +439,15 @@ The `from` command is used to specify the commit to initialize
this branch from. This revision will be the first ancestor of the
new commit.
-Omitting the `from` command in the first commit of a new branch
+Omitting the `from` command in the first commit of a branch that
+has not been created previously with a `commit` or `reset` command
will cause fast-import to create that commit with no ancestor. This
tends to be desired only for the initial commit of a project.
If the frontend creates all files from scratch when making a new
branch, a `merge` command may be used instead of `from` to start
the commit with an empty tree.
-Omitting the `from` command on existing branches is usually desired,
+Omitting the `from` command on branches that have already been
+initialized in the same stream is usually desired,
as the current commit on that branch is automatically assumed to
be the first ancestor of the new commit.
--
1.7.9.rc2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: commit/from command in git-fast-import
2012-01-27 21:09 ` Jonathan Nieder
@ 2012-01-30 15:35 ` Sverre Rabbelier
0 siblings, 0 replies; 6+ messages in thread
From: Sverre Rabbelier @ 2012-01-30 15:35 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: David Barr, Mike Hommey, git, Dmitry Ivankov
On Fri, Jan 27, 2012 at 15:09, Jonathan Nieder <jrnieder@gmail.com> wrote:
> The unfortunate term here is "existing branches", which seems to have
> been intended to refer to refs that have already been populated in
> this fast-import stream by a "commit" or "reset" command, rather than
> any old ref that already exists in the repository.
>
> In other words, instead of "existing branch", the manual should say
> something along the lines of "branch already in fast-import's internal
> branch table".
Looks sane.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-30 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-27 12:48 commit/from command in git-fast-import Mike Hommey
2012-01-27 14:00 ` David Barr
2012-01-27 14:08 ` Mike Hommey
[not found] ` <CAFfmPPN9BOp3tDetEeMjVmfFam3bgHzf=q5Am4OkTz0TqLWfbQ@mail.gmail.com>
[not found] ` <20120127144702.GA6693@glandium.org>
2012-01-27 20:56 ` David Barr
2012-01-27 21:09 ` Jonathan Nieder
2012-01-30 15:35 ` Sverre Rabbelier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).