t / t9147-git-svn-include-paths.shon commit Merge branch 'dt/unpack-save-untracked-cache-extension' (fa0624f)
   1#!/bin/sh
   2#
   3# Copyright (c) 2013 Paul Walmsley - based on t9134 by Vitaly Shukela
   4#
   5
   6test_description='git svn property tests'
   7. ./lib-git-svn.sh
   8
   9test_expect_success 'setup test repository' '
  10        svn_cmd co "$svnrepo" s &&
  11        (
  12                cd s &&
  13                mkdir qqq www xxx &&
  14                echo test_qqq > qqq/test_qqq.txt &&
  15                echo test_www > www/test_www.txt &&
  16                echo test_xxx > xxx/test_xxx.txt &&
  17                svn_cmd add qqq &&
  18                svn_cmd add www &&
  19                svn_cmd add xxx &&
  20                svn_cmd commit -m "create some files" &&
  21                svn_cmd up &&
  22                echo hi >> www/test_www.txt &&
  23                svn_cmd commit -m "modify www/test_www.txt" &&
  24                svn_cmd up
  25        )
  26'
  27
  28test_expect_success 'clone an SVN repository with filter to include qqq directory' '
  29        git svn clone --include-paths="qqq" "$svnrepo" g &&
  30        echo test_qqq > expect &&
  31        for i in g/*/*.txt; do cat $i >> expect2; done &&
  32        test_cmp expect expect2
  33'
  34
  35
  36test_expect_success 'init+fetch an SVN repository with included qqq directory' '
  37        git svn init "$svnrepo" c &&
  38        ( cd c && git svn fetch --include-paths="qqq" ) &&
  39        rm expect2 &&
  40        echo test_qqq > expect &&
  41        for i in c/*/*.txt; do cat $i >> expect2; done &&
  42        test_cmp expect expect2
  43'
  44
  45test_expect_success 'verify include-paths config saved by clone' '
  46        (
  47            cd g &&
  48            git config --get svn-remote.svn.include-paths | fgrep "qqq"
  49        )
  50'
  51
  52test_expect_success 'SVN-side change outside of www' '
  53        (
  54                cd s &&
  55                echo b >> qqq/test_qqq.txt &&
  56                svn_cmd commit -m "SVN-side change outside of www" &&
  57                svn_cmd up &&
  58                svn_cmd log -v | fgrep "SVN-side change outside of www"
  59        )
  60'
  61
  62test_expect_success 'update git svn-cloned repo (config include)' '
  63        (
  64                cd g &&
  65                git svn rebase &&
  66                printf "test_qqq\nb\n" > expect &&
  67                for i in */*.txt; do cat $i >> expect2; done &&
  68                test_cmp expect2 expect &&
  69                rm expect expect2
  70        )
  71'
  72
  73test_expect_success 'update git svn-cloned repo (option include)' '
  74        (
  75                cd c &&
  76                git svn rebase --include-paths="qqq" &&
  77                printf "test_qqq\nb\n" > expect &&
  78                for i in */*.txt; do cat $i >> expect2; done &&
  79                test_cmp expect2 expect &&
  80                rm expect expect2
  81        )
  82'
  83
  84test_expect_success 'SVN-side change inside of ignored www' '
  85        (
  86                cd s &&
  87                echo zaq >> www/test_www.txt
  88                svn_cmd commit -m "SVN-side change inside of www/test_www.txt" &&
  89                svn_cmd up &&
  90                svn_cmd log -v | fgrep "SVN-side change inside of www/test_www.txt"
  91        )
  92'
  93
  94test_expect_success 'update git svn-cloned repo (config include)' '
  95        (
  96                cd g &&
  97                git svn rebase &&
  98                printf "test_qqq\nb\n" > expect &&
  99                for i in */*.txt; do cat $i >> expect2; done &&
 100                test_cmp expect2 expect &&
 101                rm expect expect2
 102        )
 103'
 104
 105test_expect_success 'update git svn-cloned repo (option include)' '
 106        (
 107                cd c &&
 108                git svn rebase --include-paths="qqq" &&
 109                printf "test_qqq\nb\n" > expect &&
 110                for i in */*.txt; do cat $i >> expect2; done &&
 111                test_cmp expect2 expect &&
 112                rm expect expect2
 113        )
 114'
 115
 116test_expect_success 'SVN-side change in and out of included qqq' '
 117        (
 118                cd s &&
 119                echo cvf >> www/test_www.txt
 120                echo ygg >> qqq/test_qqq.txt
 121                svn_cmd commit -m "SVN-side change in and out of ignored www" &&
 122                svn_cmd up &&
 123                svn_cmd log -v | fgrep "SVN-side change in and out of ignored www"
 124        )
 125'
 126
 127test_expect_success 'update git svn-cloned repo again (config include)' '
 128        (
 129                cd g &&
 130                git svn rebase &&
 131                printf "test_qqq\nb\nygg\n" > expect &&
 132                for i in */*.txt; do cat $i >> expect2; done &&
 133                test_cmp expect2 expect &&
 134                rm expect expect2
 135        )
 136'
 137
 138test_expect_success 'update git svn-cloned repo again (option include)' '
 139        (
 140                cd c &&
 141                git svn rebase --include-paths="qqq" &&
 142                printf "test_qqq\nb\nygg\n" > expect &&
 143                for i in */*.txt; do cat $i >> expect2; done &&
 144                test_cmp expect2 expect &&
 145                rm expect expect2
 146        )
 147'
 148
 149test_done