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

[PATCH 1/2] fast-import: add 'commit from 0{40}' failing test

From
Dmitry Ivankov <divanorama@gmail.com>
Date
Sep 18, 2011, 21:20 UTC
Message-ID
<1316380846-15845-2-git-send-email-divanorama@gmail.com>
In-Reply-To
<1316380846-15845-1-git-send-email-divanorama@gmail.com>
Following shouldn't be allowed, while it is:

commit refs/heads/some committer ... data ... from `null_sha1`

It is treated as if 'from' was omitted. But it is allowed to just omit 'from' actually. And `null_sha1` being special in fast-import is an internal implementation detail.

Add a test as described.
Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 t/t9300-fast-import.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 1a6c066..8cc3f16 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -375,6 +375,18 @@ test_expect_success 'B: fail on invalid branch name "bad[branch]name"' '
 rm -f .git/objects/pack_* .git/objects/index_*
 
 cat >input <<INPUT_END
+commit refs/heads/zeromaster
+committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+data 0
+
+from 0000000000000000000000000000000000000000
+INPUT_END
+test_expect_failure 'B: fail on "from 0{40}"' '
+    test_must_fail git fast-import <input
+'
+rm -f .git/objects/pack_* .git/objects/index_*
+
+cat >input <<INPUT_END
 commit TEMP_TAG
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
 data <<COMMIT
-- 
1.7.3.4
Previous: Dmitry IvankovNext: Dmitry Ivankov
Message 2 of 5 in “fast-import: commit from null_sha1”
  1. 0/2 fast-import: commit from null_sha1Dmitry Ivankov, Sep 18, 2011
  2. 1/2 fast-import: add 'commit from 0{40}' failing testDmitry Ivankov, Sep 18, 2011
  3. 2/2 fast-import: fix 'from 0{40}' testDmitry Ivankov, Sep 18, 2011
  4. Jonathan NiederSep 18, 2011
  5. Dmitry IvankovSep 18, 2011

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.