From 74b1e1235781bbe5c90b802c1551446a5f5d69f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kr=C3=BCger?= Date: Tue, 24 Jun 2008 02:17:36 +0200 Subject: git-svn: make rebuild respect rewriteRoot option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suppose someone fetches git-svn-ified commits from another repo and then attempts to use 'git-svn init --rewrite-root=foo bar'. Using git svn rebase after that will fail badly: * For each commit tried by working_head_info, rebuild is called indirectly. * rebuild will iterate over all commits and skip all of them because the URL does not match. Because of that no rev_map file is generated at all. * Thus, rebuild will run once for every commit. This takes ages. * In the end there still isn't any rev_map file and thus working_head_info fails. Addressing this behaviour fixes an apparently not too uncommon problem with providing git-svn mirrors of Subversion repositories. Some repositories are accessed using different URLs depending on whether the user has push privileges or not. In the latter case, an anonymous URL is often used that differs from the push URL. Providing a mirror that is usable in both cases becomes a lot more possible with this change. Signed-off-by: Jan Krüger Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 t/t9123-git-svn-rebuild-with-rewriteroot.sh (limited to 't/t9123-git-svn-rebuild-with-rewriteroot.sh') diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh new file mode 100755 index 0000000000..c18878fad1 --- /dev/null +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright (c) 2008 Jan Krüger +# + +test_description='git-svn respects rewriteRoot during rebuild' + +. ./lib-git-svn.sh + +mkdir import +cd import + touch foo + svn import -m 'import for git-svn' . "$svnrepo" >/dev/null +cd .. +rm -rf import + +test_expect_success 'init, fetch and checkout repository' ' + git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" && + git svn fetch + git checkout -b mybranch remotes/git-svn + ' + +test_expect_success 'remove rev_map' ' + rm "$GIT_SVN_DIR"/.rev_map.* + ' + +test_expect_success 'rebuild rev_map' ' + git svn rebase >/dev/null + ' + +test_done + -- cgit v1.2.3 From 16805d3e59250769f409480ca3cb739281bc906c Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Mon, 8 Sep 2008 19:02:05 +0900 Subject: t/t91XX-svn: start removing use of "git-" from these tests Subversion tests use too many "git-foo" form, so I am converting them in two steps. This first step replaces literal strings "remotes/git-svn" and "git-svn-id" by introducing $remotes_git_svn and $git_svn_id constants defined as shell variables. This will reduce the number of false hits from "git grep". Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t9123-git-svn-rebuild-with-rewriteroot.sh') diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh index c18878fad1..363c1dbfc5 100755 --- a/t/t9123-git-svn-rebuild-with-rewriteroot.sh +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -17,7 +17,7 @@ rm -rf import test_expect_success 'init, fetch and checkout repository' ' git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" && git svn fetch - git checkout -b mybranch remotes/git-svn + git checkout -b mybranch ${remotes_git_svn} ' test_expect_success 'remove rev_map' ' -- cgit v1.2.3 From 1364ff27dc5ecca4c1932d8fa09fe88a7c09fda0 Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Mon, 8 Sep 2008 19:02:08 +0900 Subject: t/t91XX git-svn tests: run "git svn" not "git-svn" This replaces 'git-svn' with 'git svn' in the tests. Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t9123-git-svn-rebuild-with-rewriteroot.sh') diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh index 363c1dbfc5..ddb1a481f7 100755 --- a/t/t9123-git-svn-rebuild-with-rewriteroot.sh +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -3,7 +3,7 @@ # Copyright (c) 2008 Jan Krüger # -test_description='git-svn respects rewriteRoot during rebuild' +test_description='git svn respects rewriteRoot during rebuild' . ./lib-git-svn.sh -- cgit v1.2.3 From f964732c0560743b666ad4e189a6b148dacf6923 Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Wed, 10 Sep 2008 06:25:27 +0900 Subject: tests: use "git foo" without dash in strings This changes "git-foo" to "git foo" when message strings in tests name git subcommands. Signed-off-by: Nanako Shiraishi Signed-off-by: Junio C Hamano --- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t9123-git-svn-rebuild-with-rewriteroot.sh') diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh index ddb1a481f7..cf0415274c 100755 --- a/t/t9123-git-svn-rebuild-with-rewriteroot.sh +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -10,7 +10,7 @@ test_description='git svn respects rewriteRoot during rebuild' mkdir import cd import touch foo - svn import -m 'import for git-svn' . "$svnrepo" >/dev/null + svn import -m 'import for git svn' . "$svnrepo" >/dev/null cd .. rm -rf import -- cgit v1.2.3