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

[PATCH/RFC] fast-import: disallow empty branches as parents

From
Dmitry Ivankov <divanorama@gmail.com>
Date
Jun 20, 2012, 19:34 UTC
Message-ID
<1340220841-753-1-git-send-email-divanorama@gmail.com>

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
Next: Dmitry Ivankov
Message 1 of 5 in “fast-import: disallow empty branches as parents”
  1. fast-import: disallow empty branches as parentsDmitry Ivankov, Jun 20, 2012
  2. fast-import: disallow empty branches as parentsDmitry Ivankov, Jun 20, 2012
  3. Jonathan NiederJun 21, 2012
  4. Dmitry IvankovJun 21, 2012
  5. Dmitry IvankovJun 25, 2012

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.