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

Re: [PATCH 1/2] fast-import: filemodify after M 040000 <tree> "" crashes

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 18, 2010, 01:44 UTC
Message-ID
<20101018014404.GD25524@burratino>
In-Reply-To
<AANLkTik3iSSzKCxi9aeNw+ATPXvTN6yw-=NDGtqCidce@mail.gmail.com>
Sverre Rabbelier wrote:
> On Sun, Oct 17, 2010 at 20:03, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 8 quoted lines
>>        M 040000 <tree> ""
>>        M 100644 :1 "foo"
>>
>> and similar commands (using D, C, or R after resetting the root
>> tree) segfault.
>
> I'm curious, how come this not found earlier? Would seem like a fairly
> regular operation?
Sure, though that isn't what the feature has been used for so far.
Hooray for tests. :)
-- 8< --
Subject: t9300 (fast-import): another test for the "replace root" feature

Another test for the replace root feature. One can imagine an implementation for which R "some/subdir" "" would free some state associated to the subdir and leave fast-import confused.

Luckily, git's is not such an implementation.

While at it, change the previous test to use C "some/subdir" "" instead of R (i.e., test both syntaxes).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 t/t9300-fast-import.sh |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index ce09457..dd90a09 100755
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
@@ -990,11 +990,52 @@ test_expect_success \
 	COMMIT
 
 	M 040000 $branch ""
-	R "newdir" ""
+	C "newdir" ""
 	INPUT_END
 	 git fast-import <input &&
 	 git diff --exit-code branch:newdir N9'
 
+test_expect_success \
+	'N: modify subtree, extract it, and modify again' \
+	'echo hello >expect.baz &&
+	 echo hello, world >expect.qux &&
+	 git fast-import <<-SETUP_END &&
+	commit refs/heads/N10
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data <<COMMIT
+	hello, tree
+	COMMIT
+
+	deleteall
+	M 644 inline foo/bar/baz
+	data <<EOF
+	hello
+	EOF
+	SETUP_END
+
+	 tree=$(git rev-parse --verify N10:) &&
+	 git fast-import <<-INPUT_END &&
+	commit refs/heads/N11
+	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
+	data <<COMMIT
+	copy to root by id and modify
+	COMMIT
+
+	M 040000 $tree ""
+	M 100644 inline foo/bar/qux
+	data <<EOF
+	hello, world
+	EOF
+	R "foo" ""
+	C "bar/qux" "bar/quux"
+	INPUT_END
+	 git show N11:bar/baz >actual.baz &&
+	 git show N11:bar/qux >actual.qux &&
+	 git show N11:bar/quux >actual.quux &&
+	 test_cmp expect.baz actual.baz &&
+	 test_cmp expect.qux actual.qux &&
+	 test_cmp expect.qux actual.quux'
+
 ###
 ### series O
 ###
-- 
1.7.2.3
Previous: Sverre RabbelierNext: Jonathan Nieder
Message 24 of 31 in “fast-import: Allow filemodify to set the root”
  1. fast-import: Allow filemodify to set the rootDavid Barr, Oct 7, 2010
  2. Sverre RabbelierOct 7, 2010
  3. Jonathan NiederOct 7, 2010
  4. Sverre RabbelierOct 7, 2010
  5. David BarrOct 7, 2010
  6. fast-import: Allow filemodify to set the rootDavid Barr, Oct 7, 2010
  7. Sverre RabbelierOct 7, 2010
  8. Johannes SixtOct 8, 2010
  9. Jonathan NiederOct 8, 2010
  10. Johannes SixtOct 8, 2010
  11. Jonathan NiederOct 8, 2010
  12. Ramkumar RamachandraOct 8, 2010
  13. Gabriel FilionOct 8, 2010
  14. David Michael BarrOct 8, 2010
  15. Sverre RabbelierOct 8, 2010
  16. Jonathan NiederOct 8, 2010
  17. David Michael BarrOct 9, 2010
  18. Sverre RabbelierOct 9, 2010
  19. fast-import: Allow filemodify to set the rootDavid Barr, Oct 10, 2010
  20. Jonathan NiederOct 11, 2010
  21. 0/2 Re: fast-import: Allow filemodify to set the rootJonathan Nieder, Oct 18, 2010
  22. 1/2 fast-import: filemodify after M 040000 <tree> "" crashesJonathan Nieder, Oct 18, 2010
  23. Sverre RabbelierOct 18, 2010
  24. Jonathan NiederOct 18, 2010
  25. fast-import: do not clear notes in do_change_note_fanout()Jonathan Nieder, Oct 20, 2010
  26. 2/2 fast-import: tighten M 040000 syntaxJonathan Nieder, Oct 18, 2010
  27. Documentation/fast-import: put explanation of M 040000 <dataref> "" in contextJonathan Nieder, Jan 16, 2011
  28. Junio C HamanoJan 18, 2011
  29. Jonathan NiederJan 18, 2011
  30. Junio C HamanoJan 18, 2011
  31. Jonathan NiederJan 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.