t / t9140-git-svn-reset.shon commit Merge branch 'nd/i18n' (3813a89)
   1#!/bin/sh
   2#
   3# Copyright (c) 2009 Ben Jackson
   4#
   5
   6test_description='git svn reset'
   7. ./lib-git-svn.sh
   8
   9test_expect_success 'setup test repository' '
  10        svn_cmd co "$svnrepo" s &&
  11        (
  12                cd s &&
  13                mkdir vis &&
  14                echo always visible > vis/vis.txt &&
  15                svn_cmd add vis &&
  16                svn_cmd commit -m "create visible files" &&
  17                mkdir hid &&
  18                echo initially hidden > hid/hid.txt &&
  19                svn_cmd add hid &&
  20                svn_cmd commit -m "create initially hidden files" &&
  21                svn_cmd up &&
  22                echo mod >> vis/vis.txt &&
  23                svn_cmd commit -m "modify vis" &&
  24                svn_cmd up
  25        )
  26'
  27
  28test_expect_success 'clone SVN repository with hidden directory' '
  29        git svn init "$svnrepo" g &&
  30        ( cd g && git svn fetch --ignore-paths="^hid" )
  31'
  32
  33test_expect_success 'modify hidden file in SVN repo' '
  34        ( cd s &&
  35          echo mod hidden >> hid/hid.txt &&
  36          svn_cmd commit -m "modify hid" &&
  37          svn_cmd up
  38        )
  39'
  40
  41test_expect_success 'fetch fails on modified hidden file' '
  42        ( cd g &&
  43          git svn find-rev refs/remotes/git-svn > ../expect &&
  44          test_must_fail git svn fetch 2> ../errors &&
  45          git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
  46        fgrep "not found in commit" errors &&
  47        test_cmp expect expect2
  48'
  49
  50test_expect_success 'reset unwinds back to r1' '
  51        ( cd g &&
  52          git svn reset -r1 &&
  53          git svn find-rev refs/remotes/git-svn > ../expect2 ) &&
  54        echo 1 >expect &&
  55        test_cmp expect expect2
  56'
  57
  58test_expect_success 'refetch succeeds not ignoring any files' '
  59        ( cd g &&
  60          git svn fetch &&
  61          git svn rebase &&
  62          fgrep "mod hidden" hid/hid.txt
  63        )
  64'
  65
  66test_done