From: Mike Hommey <hidden> Date: 2016-06-15 22:52:52
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
From: David Barr <hidden> Date: 2016-06-15 22:52:52
On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey [off-list ref] 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
From: Mike Hommey <hidden> Date: 2016-06-15 22:52:52
On Sat, Jan 28, 2012 at 01:00:17AM +1100, David Barr wrote:
On Fri, Jan 27, 2012 at 11:48 PM, Mike Hommey [off-list ref] wrote:
quoted
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