git-svn: fix several fetch bugs related to repeated invocations

We no longer delete the top-level directory even if it got
deleted from the upstream repository.  In gs_do_update; we
double-check that the path we're tracking exists at both
endpoints before proceeding.  We have also added additional
protection against fetching revisions out-of-order.

To simplify our internal interfaces, I've disabled passing the
'recursive' flag to the gs_do_{switch,update} wrapper functions
since we always want it in git-svn.  We also pass the
entire Git::SVN object rather than just the path because it
helped me debug.

When printing progress, the refname is printed out to make
it less confusing when multi-fetch is running.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh
index dcec16b..41b9c19 100755
--- a/t/t9104-git-svn-follow-parent.sh
+++ b/t/t9104-git-svn-follow-parent.sh
@@ -95,12 +95,12 @@
         "
 
 test_expect_success 'follow deleted directory' "
-	svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye&&
+	svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
 	svn rm -m 'remove glob' $svnrepo/glob &&
 	git-svn init -i glob $svnrepo/glob &&
 	git-svn fetch -i glob &&
-	test \"\`git cat-file blob refs/remotes/glob~1:blob/bye\`\" = hi &&
-	test -z \"\`git ls-tree -z refs/remotes/glob\`\"
+	test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
+	test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
 	"
 
 # ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
@@ -146,6 +146,16 @@
 	     \"\`git rev-parse r9270-d~1\`\"
 	"
 
+test_expect_success "multi-fetch continues to work" "
+	git-svn multi-fetch --follow-parent
+	"
+
+test_expect_success "multi-fetch works off a 'clean' repository" "
+	rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
+	mkdir $GIT_DIR/svn &&
+	git-svn multi-fetch --follow-parent
+	"
+
 test_debug 'gitk --all &'
 
 test_done