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