t / t9108-git-svn-glob.shon commit builtin-rm: fix index lock file path (4d26467)
   1#!/bin/sh
   2# Copyright (c) 2007 Eric Wong
   3test_description='git-svn globbing refspecs'
   4. ./lib-git-svn.sh
   5
   6cat > expect.end <<EOF
   7the end
   8hi
   9start a new branch
  10initial
  11EOF
  12
  13test_expect_success 'test refspec globbing' '
  14        mkdir -p trunk/src/a trunk/src/b trunk/doc &&
  15        echo "hello world" > trunk/src/a/readme &&
  16        echo "goodbye world" > trunk/src/b/readme &&
  17        svn import -m "initial" trunk "$svnrepo"/trunk &&
  18        svn co "$svnrepo" tmp &&
  19        cd tmp &&
  20                mkdir branches tags &&
  21                svn add branches tags &&
  22                svn cp trunk branches/start &&
  23                svn commit -m "start a new branch" &&
  24                svn up &&
  25                echo "hi" >> branches/start/src/b/readme &&
  26                poke branches/start/src/b/readme &&
  27                echo "hey" >> branches/start/src/a/readme &&
  28                poke branches/start/src/a/readme &&
  29                svn commit -m "hi" &&
  30                svn up &&
  31                svn cp branches/start tags/end &&
  32                echo "bye" >> tags/end/src/b/readme &&
  33                poke tags/end/src/b/readme &&
  34                echo "aye" >> tags/end/src/a/readme &&
  35                poke tags/end/src/a/readme &&
  36                svn commit -m "the end" &&
  37                echo "byebye" >> tags/end/src/b/readme &&
  38                poke tags/end/src/b/readme &&
  39                svn commit -m "nothing to see here"
  40                cd .. &&
  41        git config --add svn-remote.svn.url "$svnrepo" &&
  42        git config --add svn-remote.svn.fetch \
  43                         "trunk/src/a:refs/remotes/trunk" &&
  44        git config --add svn-remote.svn.branches \
  45                         "branches/*/src/a:refs/remotes/branches/*" &&
  46        git config --add svn-remote.svn.tags\
  47                         "tags/*/src/a:refs/remotes/tags/*" &&
  48        git-svn multi-fetch &&
  49        git log --pretty=oneline refs/remotes/tags/end | \
  50            sed -e "s/^.\{41\}//" > output.end &&
  51        cmp expect.end output.end &&
  52        test "`git rev-parse refs/remotes/tags/end~1`" = \
  53                "`git rev-parse refs/remotes/branches/start`" &&
  54        test "`git rev-parse refs/remotes/branches/start~2`" = \
  55                "`git rev-parse refs/remotes/trunk`"
  56        '
  57
  58echo try to try > expect.two
  59echo nothing to see here >> expect.two
  60cat expect.end >> expect.two
  61
  62test_expect_success 'test left-hand-side only globbing' '
  63        git config --add svn-remote.two.url "$svnrepo" &&
  64        git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
  65        git config --add svn-remote.two.branches \
  66                         "branches/*:refs/remotes/two/branches/*" &&
  67        git config --add svn-remote.two.tags \
  68                         "tags/*:refs/remotes/two/tags/*" &&
  69        cd tmp &&
  70                echo "try try" >> tags/end/src/b/readme &&
  71                poke tags/end/src/b/readme &&
  72                svn commit -m "try to try"
  73                cd .. &&
  74        git-svn fetch two &&
  75        test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 &&
  76        test `git rev-list refs/remotes/two/branches/start | wc -l` -eq 3 &&
  77        test `git rev-parse refs/remotes/two/branches/start~2` = \
  78             `git rev-parse refs/remotes/two/trunk` &&
  79        test `git rev-parse refs/remotes/two/tags/end~3` = \
  80             `git rev-parse refs/remotes/two/branches/start` &&
  81        git log --pretty=oneline refs/remotes/two/tags/end | \
  82            sed -e "s/^.\{41\}//" > output.two &&
  83        cmp expect.two output.two
  84        '
  85
  86test_done