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

[PATCH 1/2] t5704 (bundle): rewrite for larger coverage

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Dec 15, 2011, 16:45 UTC
Message-ID
<1323967528-10537-2-git-send-email-artagnon@gmail.com>
In-Reply-To
<1323967528-10537-1-git-send-email-artagnon@gmail.com>

Rewrite the git-bundle testsuite to exercise more of its functionality.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 t/t5704-bundle.sh |   95 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/t/t5704-bundle.sh b/t/t5704-bundle.sh
index 728ccd8..09ff4f1 100755
--- a/t/t5704-bundle.sh
+++ b/t/t5704-bundle.sh
@@ -1,56 +1,99 @@
 #!/bin/sh
 
-test_description='some bundle related tests'
+test_description='Test git-bundle'
 . ./test-lib.sh
 
 test_expect_success 'setup' '
+	git config core.logAllRefUpdates false &&
+	test_commit initial &&
+	git checkout -b branch &&
+	test_commit second &&
+	test_commit third &&
+	git checkout master &&
+	test_commit fourth file
+'
 
-	: > file &&
-	git add file &&
-	test_tick &&
-	git commit -m initial &&
-	test_tick &&
-	git tag -m tag tag &&
-	: > file2 &&
-	git add file2 &&
-	: > file3 &&
-	test_tick &&
-	git commit -m second &&
-	git add file3 &&
-	test_tick &&
-	git commit -m third
+test_expect_success 'create succeeds' '
+	git bundle create bundle second third &&
+	cat >expect <<-\EOF &&
+	OBJID	refs/tags/third
+	OBJID	refs/tags/second
+	EOF
+	{
+		git ls-remote bundle |
+		sed "s/$_x40/OBJID/g"
+	} >actual &&
+	test_cmp expect actual
+'
 
+test_expect_success 'verify succeeds' '
+	git bundle create bundle second third &&
+	git bundle verify bundle
 '
 
-test_expect_success 'tags can be excluded by rev-list options' '
+test_expect_success 'list-heads succeeds' '
+	git bundle create bundle second third &&
+	cat >expect <<-\EOF &&
+	OBJID refs/tags/second
+	OBJID refs/tags/third
+	EOF
+	{
+		git bundle list-heads bundle |
+		sed "s/$_x40/OBJID/g"
+	} >actual &&
+	test_cmp expect actual
+'
 
-	git bundle create bundle --all --since=7.Apr.2005.15:16:00.-0700 &&
-	git ls-remote bundle > output &&
-	! grep tag output
+test_expect_success 'create dies on invalid bundle filename' '
+	mkdir adir &&
+	test_expect_code 128 git bundle create adir --all
+'
 
+test_expect_success 'disallow stray command-line options' '
+	test_must_fail git bundle create --junk bundle second third
 '
 
-test_expect_success 'die if bundle file cannot be created' '
+test_expect_failure 'disallow stray command-line arguments' '
+	git bundle create bundle second third &&
+	test_must_fail git bundle verify bundle junk
+'
 
-	mkdir adir &&
-	test_must_fail git bundle create adir --all
+test_expect_success 'create accepts rev-list options to narrow refs' '
+	git bundle create bundle --all -- file &&
+	cat >expect <<-\EOF &&
+	OBJID	HEAD
+	OBJID	refs/tags/fourth
+	OBJID	refs/heads/master
+	EOF
+	{
+		git ls-remote bundle |
+		sed "s/$_x40/OBJID/g"
+	} >actual &&
+	test_cmp expect actual
+'
 
+test_expect_success 'unbundle succeeds' '
+	saved=$(git rev-parse third) &&
+	git bundle create bundle second third fourth &&
+	git tag -d second third fourth &&
+	git branch -D branch &&
+	git reset --hard initial &&
+	git prune &&
+	test_must_fail git reset --hard $saved &&
+	git bundle unbundle bundle &&
+	git reset --hard $saved
 '
 
 test_expect_failure 'bundle --stdin' '
-
 	echo master | git bundle create stdin-bundle.bdl --stdin &&
 	git ls-remote stdin-bundle.bdl >output &&
 	grep master output
-
 '
 
 test_expect_failure 'bundle --stdin <rev-list options>' '
-
 	echo master | git bundle create hybrid-bundle.bdl --stdin tag &&
 	git ls-remote hybrid-bundle.bdl >output &&
 	grep master output
-
 '
 
 test_done
-- 
1.7.4.1
Previous: Ramkumar RamachandraNext: Jonathan Nieder
Message 21 of 50 in “Fix '&&' chaining in tests”
  1. 0/6 Fix '&&' chaining in testsRamkumar Ramachandra, Dec 8, 2011
  2. 1/2 parse-options: introduce OPT_SUBCOMMANDRamkumar Ramachandra, Dec 8, 2011
  3. Jonathan NiederDec 8, 2011
  4. Ramkumar RamachandraDec 8, 2011
  5. 1/6 t3040 (subprojects-basic): modernize styleRamkumar Ramachandra, Dec 8, 2011
  6. Jonathan NiederDec 8, 2011
  7. Ramkumar RamachandraDec 9, 2011
  8. Junio C HamanoDec 9, 2011
  9. Ramkumar RamachandraDec 9, 2011
  10. 2/2 bundle: rewrite builtin to use parse-optionsRamkumar Ramachandra, Dec 8, 2011
  11. Jonathan NiederDec 8, 2011
  12. Ramkumar RamachandraDec 8, 2011
  13. Jonathan NiederDec 8, 2011
  14. Ramkumar RamachandraDec 8, 2011
  15. Jonathan NiederDec 8, 2011
  16. Ramkumar RamachandraDec 8, 2011
  17. Junio C HamanoDec 8, 2011
  18. Jakub NarebskiDec 9, 2011
  19. Junio C HamanoDec 9, 2011
  20. 0/2 Improve git-bundle builtinRamkumar Ramachandra, Dec 15, 2011
  21. 1/2 t5704 (bundle): rewrite for larger coverageRamkumar Ramachandra, Dec 15, 2011
  22. Jonathan NiederDec 15, 2011
  23. 2/2 bundle: rewrite builtin to use parse-optionsRamkumar Ramachandra, Dec 15, 2011
  24. Jonathan NiederDec 15, 2011
  25. Jonathan NiederDec 15, 2011
  26. Junio C HamanoDec 15, 2011
  27. 2/6 t3030 (merge-recursive): use test_expect_codeRamkumar Ramachandra, Dec 8, 2011
  28. 3/6 t1006 (cat-file): use test_cmpRamkumar Ramachandra, Dec 8, 2011
  29. Matthieu MoyDec 8, 2011
  30. Ramkumar RamachandraDec 8, 2011
  31. Matthieu MoyDec 8, 2011
  32. Jonathan NiederDec 8, 2011
  33. 4/6 t3200 (branch): fix '&&' chainingRamkumar Ramachandra, Dec 8, 2011
  34. Jonathan NiederDec 8, 2011
  35. 5/6 t1510 (worktree): fix '&&' chainingRamkumar Ramachandra, Dec 8, 2011
  36. Jonathan NiederDec 8, 2011
  37. Junio C HamanoDec 9, 2011
  38. 6/6 test: fix '&&' chainingRamkumar Ramachandra, Dec 8, 2011
  39. Jonathan NiederDec 8, 2011
  40. Junio C HamanoDec 8, 2011
  41. Ramkumar RamachandraDec 9, 2011
  42. 0/6 Fix '&&' chaining in testsRamkumar Ramachandra, Dec 9, 2011
  43. 1/6 t3040 (subprojects-basic): fix '&&' chaining, modernize styleRamkumar Ramachandra, Dec 9, 2011
  44. 2/6 t3030 (merge-recursive): use test_expect_codeRamkumar Ramachandra, Dec 9, 2011
  45. 3/6 t1006 (cat-file): use test_cmpRamkumar Ramachandra, Dec 9, 2011
  46. Junio C HamanoDec 9, 2011
  47. Ramkumar RamachandraDec 9, 2011
  48. 4/6 t3200 (branch): fix '&&' chainingRamkumar Ramachandra, Dec 9, 2011
  49. 5/6 t1510 (worktree): fix '&&' chainingRamkumar Ramachandra, Dec 9, 2011
  50. 6/6 tests: fix '&&' chainingRamkumar Ramachandra, Dec 9, 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.