git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Ivankov <divanorama@gmail.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Dmitry Ivankov <divanorama@gmail.com>
Subject: [PATCH/RFC] fast-import: disallow empty branches as parents
Date: Thu, 21 Jun 2012 01:34:00 +0600	[thread overview]
Message-ID: <1340220841-753-1-git-send-email-divanorama@gmail.com> (raw)

Combinations of "reset", "commit" with "from" and/or "merge" commands
may make fast-import to produce bad objects (null_sha1 parents) or
accept bad inputs (ones asking for empty branches as parents).

Fix this and add some tests.


One RFC here: does following use case make any sense/should it be allowed?

    commit refs/heads/master
    ...
    from something
    merge refs/heads/master

1. If "from" is omitted or equals refs/heads/master we end up with duplicated parents.
2. And if something is not master we allow to pick a new first parent path.

"2" seems quite legal, while "1" looks worse. Though "1" is not directly related to
this patch and can be reproduced via a simple "merge X X" command for example.


Dmitry Ivankov (1):
  fast-import: disallow empty branches as parents

 fast-import.c          |   49 +++++++++++++++++++++++++++++------------------
 t/t9300-fast-import.sh |   48 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 19 deletions(-)

-- 
1.7.3.4

             reply	other threads:[~2012-06-20 19:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 19:34 Dmitry Ivankov [this message]
2012-06-20 19:34 ` [PATCH] fast-import: disallow empty branches as parents Dmitry Ivankov
2012-06-21  3:57   ` Jonathan Nieder
2012-06-21  6:39     ` Dmitry Ivankov
2012-06-25  8:00 ` [PATCH/RFC] " Dmitry Ivankov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340220841-753-1-git-send-email-divanorama@gmail.com \
    --to=divanorama@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=srabbelier@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).