Code

t: use sane_unset instead of unset
[git.git] / t / t9130-git-svn-authors-file.sh
index b8fb277562e7782cf538ba7011214b4cf9136484..c3443ceb251f87806312f4e6dadb54881b52a8fe 100755 (executable)
@@ -15,12 +15,12 @@ EOF
 test_expect_success 'setup svnrepo' '
        for i in aa bb cc dd
        do
-               svn mkdir -m $i --username $i "$svnrepo"/$i
+               svn_cmd mkdir -m $i --username $i "$svnrepo"/$i
        done
        '
 
 test_expect_success 'start import with incomplete authors file' '
-       ! git svn clone --authors-file=svn-authors "$svnrepo" x
+       test_must_fail git svn clone --authors-file=svn-authors "$svnrepo" x
        '
 
 test_expect_success 'imported 2 revisions successfully' '
@@ -52,18 +52,18 @@ test_expect_success 'continues to import once authors have been added' '
        '
 
 test_expect_success 'authors-file against globs' '
-       svn mkdir -m globs --username aa \
+       svn_cmd mkdir -m globs --username aa \
          "$svnrepo"/aa/trunk "$svnrepo"/aa/branches "$svnrepo"/aa/tags &&
        git svn clone --authors-file=svn-authors -s "$svnrepo"/aa aa-work &&
        for i in bb ee cc
        do
                branch="aa/branches/$i"
-               svn mkdir -m "$branch" --username $i "$svnrepo/$branch"
+               svn_cmd mkdir -m "$branch" --username $i "$svnrepo/$branch"
        done
        '
 
 test_expect_success 'fetch fails on ee' '
-       ( cd aa-work && ! git svn fetch --authors-file=../svn-authors )
+       ( cd aa-work && test_must_fail git svn fetch --authors-file=../svn-authors )
        '
 
 tmp_config_get () {
@@ -91,4 +91,24 @@ test_expect_success 'fetch continues after authors-file is fixed' '
        )
        '
 
+test_expect_success 'fresh clone with svn.authors-file in config' '
+       (
+               rm -r "$GIT_DIR" &&
+               test x = x"$(git config svn.authorsfile)" &&
+               test_config="$HOME"/.gitconfig &&
+               sane_unset GIT_DIR &&
+               sane_unset GIT_CONFIG &&
+               git config --global \
+                 svn.authorsfile "$HOME"/svn-authors &&
+               test x"$HOME"/svn-authors = x"$(git config svn.authorsfile)" &&
+               git svn clone "$svnrepo" gitconfig.clone &&
+               cd gitconfig.clone &&
+               nr_ex=$(git log | grep "^Author:.*example.com" | wc -l) &&
+               nr_rev=$(git rev-list HEAD | wc -l) &&
+               test $nr_rev -eq $nr_ex
+       )
+'
+
+test_debug 'GIT_DIR=gitconfig.clone/.git git log'
+
 test_done