t / t9124-git-svn-dcommit-auto-props.shon commit Merge git-gui 0.11.0 (373a273)
   1#!/bin/sh
   2#
   3# Copyright (c) 2008 Brad King
   4
   5test_description='git-svn dcommit honors auto-props'
   6
   7. ./lib-git-svn.sh
   8
   9generate_auto_props() {
  10cat << EOF
  11[miscellany]
  12enable-auto-props=$1
  13[auto-props]
  14*.sh  = svn:mime-type=application/x-shellscript; svn:eol-style=LF
  15*.txt = svn:mime-type=text/plain; svn:eol-style = native
  16EOF
  17}
  18
  19test_expect_success 'initialize git-svn' '
  20        mkdir import &&
  21        (
  22                cd import &&
  23                echo foo >foo &&
  24                svn import -m "import for git-svn" . "$svnrepo"
  25        ) &&
  26        rm -rf import &&
  27        git-svn init "$svnrepo"
  28        git-svn fetch
  29'
  30
  31test_expect_success 'enable auto-props config' '
  32        cd "$gittestrepo" &&
  33        mkdir user &&
  34        generate_auto_props yes >user/config
  35'
  36
  37test_expect_success 'add files matching auto-props' '
  38        cd "$gittestrepo" &&
  39        echo "#!$SHELL_PATH" >exec1.sh &&
  40        chmod +x exec1.sh &&
  41        echo "hello" >hello.txt &&
  42        echo bar >bar &&
  43        git add exec1.sh hello.txt bar &&
  44        git commit -m "files for enabled auto-props" &&
  45        git svn dcommit --config-dir=user
  46'
  47
  48test_expect_success 'disable auto-props config' '
  49        cd "$gittestrepo" &&
  50        generate_auto_props no >user/config
  51'
  52
  53test_expect_success 'add files matching disabled auto-props' '
  54        cd "$gittestrepo" &&
  55        echo "#$SHELL_PATH" >exec2.sh &&
  56        chmod +x exec2.sh &&
  57        echo "world" >world.txt &&
  58        echo zot >zot &&
  59        git add exec2.sh world.txt zot &&
  60        git commit -m "files for disabled auto-props" &&
  61        git svn dcommit --config-dir=user
  62'
  63
  64test_expect_success 'check resulting svn repository' '
  65        mkdir work &&
  66        cd work &&
  67        svn co "$svnrepo" &&
  68        cd svnrepo &&
  69
  70        # Check properties from first commit.
  71        test "x$(svn propget svn:executable exec1.sh)" = "x*" &&
  72        test "x$(svn propget svn:mime-type exec1.sh)" = \
  73             "xapplication/x-shellscript" &&
  74        test "x$(svn propget svn:mime-type hello.txt)" = "xtext/plain" &&
  75        test "x$(svn propget svn:eol-style hello.txt)" = "xnative" &&
  76        test "x$(svn propget svn:mime-type bar)" = "x" &&
  77
  78        # Check properties from second commit.
  79        test "x$(svn propget svn:executable exec2.sh)" = "x*" &&
  80        test "x$(svn propget svn:mime-type exec2.sh)" = "x" &&
  81        test "x$(svn propget svn:mime-type world.txt)" = "x" &&
  82        test "x$(svn propget svn:eol-style world.txt)" = "x" &&
  83        test "x$(svn propget svn:mime-type zot)" = "x"
  84'
  85
  86test_done