From b805b44a923e32251af1abd4e8d7bf5f7d4d8ef6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 22 Jan 2007 13:52:04 -0800 Subject: git-svn: disallow ambigious local refspecs Having multiple fetch refspecs pointing to the same local ref would be a very bad thing. Start avoiding the use of fatal() or exit() inside the modules so we can libify more easily. Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 040da92756..af617486dd 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -215,4 +215,15 @@ echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected test_expect_success "$name" "diff -u a expected" +test_expect_failure 'exit if remote refs are ambigious' " + git-repo-config --add svn-remote.git-svn.fetch \ + bar:refs/remotes/git-svn && + git-svn migrate + " +test_expect_failure 'exit if init-ing a would clobber a URL' " + git-repo-config --unset svn-remote.git-svn.fetch \ + '^bar:refs/remotes/git-svn$' && + git-svn init $svnrepo/bar + " + test_done -- cgit v1.2.1 From e6434f876097f196acbd9a806637d0f6076752fd Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Jan 2007 16:29:23 -0800 Subject: git-svn: 'init' attempts to connect to the repository root if possible This allows connections to be used more efficiently and not require users to run 'git-svn migrate --minimize' for new repositories. Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index af617486dd..97798c4d07 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -220,10 +220,22 @@ test_expect_failure 'exit if remote refs are ambigious' " bar:refs/remotes/git-svn && git-svn migrate " + test_expect_failure 'exit if init-ing a would clobber a URL' " + svnadmin create ${PWD}/svnrepo2 && + svn mkdir -m 'mkdir bar' ${svnrepo}2/bar && git-repo-config --unset svn-remote.git-svn.fetch \ '^bar:refs/remotes/git-svn$' && - git-svn init $svnrepo/bar + git-svn init ${svnrepo}2/bar + " + +test_expect_success \ + 'init allows us to connect to another directory in the same repo' " + git-svn init -i bar $svnrepo/bar && + git repo-config --get svn-remote.git-svn.fetch \ + '^bar:refs/remotes/bar$' && + git repo-config --get svn-remote.git-svn.fetch \ + '^:refs/remotes/git-svn$' " test_done -- cgit v1.2.1 From 97f6987afaae239f7e3ae3944e0b29343b43a894 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 25 Jan 2007 11:53:13 -0800 Subject: git-svn: avoid tracking change-less revisions They simply aren't interesting to track, and this will allow us to avoid get_log(). Since r0 is covered by this, we need to update the tests to not rely on r0 (which is always empty). Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 97798c4d07..5355243b92 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -211,8 +211,6 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4 EOF -echo tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 >> expected - test_expect_success "$name" "diff -u a expected" test_expect_failure 'exit if remote refs are ambigious' " -- cgit v1.2.1 From d3a840dc74d2098c31aac1b89093d847e1d33dd8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 26 Jan 2007 01:32:45 -0800 Subject: git-svn: fix committing to subdirectories, add tests I broke this part with the URL minimization; since git-svn will now try to connect to the root of the repository and will end up writing files there if it can... Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 5355243b92..3dc4de2fad 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -236,4 +236,33 @@ test_expect_success \ '^:refs/remotes/git-svn$' " +test_expect_success 'able to dcommit to a subdirectory' " + git-svn fetch -i bar && + git checkout -b my-bar refs/remotes/bar && + echo abc > d && + git update-index --add d && + git commit -m '/bar/d should be in the log' && + git-svn dcommit -i bar && + test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" && + mkdir newdir && + echo new > newdir/dir && + git update-index --add newdir/dir && + git commit -m 'add a new directory' && + git-svn dcommit -i bar && + test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" && + echo foo >> newdir/dir && + git update-index newdir/dir && + git commit -m 'modify a file in new directory' && + git-svn dcommit -i bar && + test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" + " + +test_expect_success 'able to set-tree to a subdirectory' " + echo cba > d && + git update-index d && + git commit -m 'update /bar/d' && + git-svn set-tree -i bar HEAD && + test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\" + " + test_done -- cgit v1.2.1 From 9fa00b655cfd67bf344668a0d913f90ec9a8141d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 3 Feb 2007 12:49:48 -0800 Subject: git-svn: just name the default svn-remote "svn" instead of "git-svn" It can be confusing and redundant, since historically the default remote ref (not remote itself) has been "git-svn", too. Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 3dc4de2fad..8b6c8ffe10 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -214,7 +214,7 @@ EOF test_expect_success "$name" "diff -u a expected" test_expect_failure 'exit if remote refs are ambigious' " - git-repo-config --add svn-remote.git-svn.fetch \ + git-repo-config --add svn-remote.svn.fetch \ bar:refs/remotes/git-svn && git-svn migrate " @@ -222,7 +222,7 @@ test_expect_failure 'exit if remote refs are ambigious' " test_expect_failure 'exit if init-ing a would clobber a URL' " svnadmin create ${PWD}/svnrepo2 && svn mkdir -m 'mkdir bar' ${svnrepo}2/bar && - git-repo-config --unset svn-remote.git-svn.fetch \ + git-repo-config --unset svn-remote.svn.fetch \ '^bar:refs/remotes/git-svn$' && git-svn init ${svnrepo}2/bar " @@ -230,9 +230,9 @@ test_expect_failure 'exit if init-ing a would clobber a URL' " test_expect_success \ 'init allows us to connect to another directory in the same repo' " git-svn init -i bar $svnrepo/bar && - git repo-config --get svn-remote.git-svn.fetch \ + git repo-config --get svn-remote.svn.fetch \ '^bar:refs/remotes/bar$' && - git repo-config --get svn-remote.git-svn.fetch \ + git repo-config --get svn-remote.svn.fetch \ '^:refs/remotes/git-svn$' " -- cgit v1.2.1 From ccb6b6f5b50bb32f90222a3e801a1901bf0b5657 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 13 Feb 2007 17:38:58 -0800 Subject: t910*: s/repo-config/config/g; poke around possible race conditions Some of the repo-config => config renaming missed the git-svn tests; so I'm just renaming them to be consisten with the rest of the modern git. Also, some of the newer tests didn't have 'poke' in them to workaround race conditions on fast machines. This adds places where they can _possibly_ occur; but I don't have fast enough hardware to trigger them. Signed-off-by: Eric Wong --- t/t9100-git-svn-basic.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/t9100-git-svn-basic.sh') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 8b6c8ffe10..7dcfc7e7db 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -214,7 +214,7 @@ EOF test_expect_success "$name" "diff -u a expected" test_expect_failure 'exit if remote refs are ambigious' " - git-repo-config --add svn-remote.svn.fetch \ + git-config --add svn-remote.svn.fetch \ bar:refs/remotes/git-svn && git-svn migrate " @@ -222,7 +222,7 @@ test_expect_failure 'exit if remote refs are ambigious' " test_expect_failure 'exit if init-ing a would clobber a URL' " svnadmin create ${PWD}/svnrepo2 && svn mkdir -m 'mkdir bar' ${svnrepo}2/bar && - git-repo-config --unset svn-remote.svn.fetch \ + git-config --unset svn-remote.svn.fetch \ '^bar:refs/remotes/git-svn$' && git-svn init ${svnrepo}2/bar " @@ -230,9 +230,9 @@ test_expect_failure 'exit if init-ing a would clobber a URL' " test_expect_success \ 'init allows us to connect to another directory in the same repo' " git-svn init -i bar $svnrepo/bar && - git repo-config --get svn-remote.svn.fetch \ + git config --get svn-remote.svn.fetch \ '^bar:refs/remotes/bar$' && - git repo-config --get svn-remote.svn.fetch \ + git config --get svn-remote.svn.fetch \ '^:refs/remotes/git-svn$' " -- cgit v1.2.1