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

[PATCH] Add tests for handling corrupted caches

From
Jason Gross <jgross@mit.edu>
Date
Aug 22, 2011, 04:10 UTC
Message-ID
<1313986210-6536-1-git-send-email-jgross@mit.edu>
In-Reply-To
<1313979422-21286-1-git-send-email-jgross@mit.edu>

There might be a more straightforward way to generate an svn repository with mergeinfo, but I'm not very familiar with svn.

Signed-off-by: Jason Gross <jgross@mit.edu>
---
 t/t9160-git-svn-caches.sh |   59 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100755 t/t9160-git-svn-caches.sh
diff --git a/t/t9160-git-svn-caches.sh b/t/t9160-git-svn-caches.sh
new file mode 100755
index 0000000..bba437a
--- /dev/null
+++ b/t/t9160-git-svn-caches.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+test_description='git svn handling of .git/svn/.caches'
+
+. ./lib-git-svn.sh
+
+say 'define NO_SVN_TESTS to skip git svn tests'
+
+test_expect_success 'initialize source svn repo' '
+	svn_cmd mkdir -m x "$svnrepo"/trunk "$svnrepo"/branches &&
+	svn_cmd co "$svnrepo" "$SVN_TREE"
+'
+
+test_expect_success 'make a change that gives mergeinfo' '
+	(
+		cd "$SVN_TREE" &&
+		touch trunk/foo &&
+		svn_cmd add trunk/foo &&
+		svn_cmd commit -m "foo" &&
+		svn_cmd up &&
+		svn_cmd cp trunk branches/1
+		svn_cmd commit -m "make branch" &&
+		svn_cmd up &&
+		touch branches/1/bar &&
+		svn_cmd add branches/1/bar &&
+		svn_cmd commit -m bar &&
+		svn_cmd up &&
+		cd trunk &&
+		svn_cmd merge ../branches/1 &&
+		svn_cmd commit -m merge &&
+		svn_cmd up
+	)
+'
+
+test_expect_success 'clone svn repo and corrupt .caches' '
+	git svn init "$svnrepo" -T trunk -b branches &&
+	git svn fetch &&
+	echo corrupted > .git/svn/.caches/lookup_svn_merge.db
+'
+
+test_expect_success 'make another change that generates mergeinfo' '
+	(
+		cd "$SVN_TREE" &&
+		touch branches/1/baz &&
+		svn_cmd commit -m baz &&
+		svn_cmd up &&
+		cd trunk &&
+		svn_cmd merge ../branches/1 &&
+		svn_cmd commit -m merge2 &&
+		svn_cmd up
+	) &&
+	rm -rf "$SVN_TREE"
+'
+
+test_expect_success 'fetch change with mergeinfo with a corrupted cache' '
+	git svn fetch
+'
+
+test_done
-- 
1.7.6.558.g4b2f
Previous: Jason GrossNext: Jonathan Nieder
Message 3 of 26 in “git-svn: Destroy the cache when we fail to read it”
  1. git-svn: Destroy the cache when we fail to read itJason Gross, Aug 22, 2011
  2. Jason GrossAug 22, 2011
  3. Add tests for handling corrupted cachesJason Gross, Aug 22, 2011
  4. Jonathan NiederAug 23, 2011
  5. Jonathan NiederAug 23, 2011
  6. Jason GrossAug 23, 2011
  7. Eric WongAug 23, 2011
  8. Junio C HamanoAug 23, 2011
  9. Eric WongAug 23, 2011
  10. git-svn: use YAML format for mergeinfo cache when possibleJonathan Nieder, May 27, 2012
  11. 2/1 fixup! git-svn: use YAML format for mergeinfo cache when possibleJonathan Nieder, May 27, 2012
  12. Eric WongMay 27, 2012
  13. Jonathan NiederMay 28, 2012
  14. 0/2 git-svn: give SVN::Git::Fetcher its own fileJonathan Nieder, May 28, 2012
  15. 1/2 git-svn: rename SVN::Git::* packages to Git::SVN::*Jonathan Nieder, May 28, 2012
  16. 2/2 git-svn: make Git::SVN::Fetcher a separate fileJonathan Nieder, May 28, 2012
  17. Eric WongMay 29, 2012
  18. Junio C HamanoMay 29, 2012
  19. 0/3 git-svn: use YAML format for mergeinfo cache when possibleJonathan Nieder, Jun 9, 2012
  20. 1/3 git-svn: make Git::SVN::Editor a separate fileJonathan Nieder, Jun 9, 2012
  21. 2/3 git-svn: make Git::SVN::RA a separate fileJonathan Nieder, Jun 9, 2012
  22. 3/3 git-svn: use YAML format for mergeinfo cache when possibleJonathan Nieder, Jun 9, 2012
  23. Jonathan NiederJun 13, 2012
  24. Eric WongJun 10, 2012
  25. Jonathan NiederJun 10, 2012
  26. Junio C HamanoJun 11, 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.