2008-07-25 23:32:37 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2008 Brad King
|
|
|
|
|
2008-09-08 18:02:08 +08:00
|
|
|
test_description='git svn dcommit honors auto-props'
|
2008-07-25 23:32:37 +08:00
|
|
|
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
generate_auto_props() {
|
|
|
|
cat << EOF
|
|
|
|
[miscellany]
|
|
|
|
enable-auto-props=$1
|
|
|
|
[auto-props]
|
|
|
|
*.sh = svn:mime-type=application/x-shellscript; svn:eol-style=LF
|
|
|
|
*.txt = svn:mime-type=text/plain; svn:eol-style = native
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2008-09-10 05:25:27 +08:00
|
|
|
test_expect_success 'initialize git svn' '
|
2008-07-25 23:32:37 +08:00
|
|
|
mkdir import &&
|
|
|
|
(
|
|
|
|
cd import &&
|
|
|
|
echo foo >foo &&
|
2009-05-08 16:06:16 +08:00
|
|
|
svn_cmd import -m "import for git svn" . "$svnrepo"
|
2008-07-25 23:32:37 +08:00
|
|
|
) &&
|
|
|
|
rm -rf import &&
|
2010-10-31 09:46:54 +08:00
|
|
|
git svn init "$svnrepo" &&
|
2008-09-08 18:02:08 +08:00
|
|
|
git svn fetch
|
2008-07-25 23:32:37 +08:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'enable auto-props config' '
|
|
|
|
mkdir user &&
|
|
|
|
generate_auto_props yes >user/config
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'add files matching auto-props' '
|
|
|
|
echo "#!$SHELL_PATH" >exec1.sh &&
|
|
|
|
chmod +x exec1.sh &&
|
|
|
|
echo "hello" >hello.txt &&
|
|
|
|
echo bar >bar &&
|
|
|
|
git add exec1.sh hello.txt bar &&
|
|
|
|
git commit -m "files for enabled auto-props" &&
|
|
|
|
git svn dcommit --config-dir=user
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'disable auto-props config' '
|
|
|
|
generate_auto_props no >user/config
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'add files matching disabled auto-props' '
|
|
|
|
echo "#$SHELL_PATH" >exec2.sh &&
|
|
|
|
chmod +x exec2.sh &&
|
|
|
|
echo "world" >world.txt &&
|
|
|
|
echo zot >zot &&
|
|
|
|
git add exec2.sh world.txt zot &&
|
|
|
|
git commit -m "files for disabled auto-props" &&
|
|
|
|
git svn dcommit --config-dir=user
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'check resulting svn repository' '
|
2008-09-07 09:29:12 +08:00
|
|
|
(
|
2008-07-25 23:32:37 +08:00
|
|
|
mkdir work &&
|
|
|
|
cd work &&
|
2009-05-08 16:06:16 +08:00
|
|
|
svn_cmd co "$svnrepo" &&
|
2008-07-25 23:32:37 +08:00
|
|
|
cd svnrepo &&
|
|
|
|
|
|
|
|
# Check properties from first commit.
|
2009-05-08 16:06:16 +08:00
|
|
|
test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
|
|
|
|
test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
|
2008-07-25 23:32:37 +08:00
|
|
|
"xapplication/x-shellscript" &&
|
2009-05-08 16:06:16 +08:00
|
|
|
test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
|
|
|
|
test "x$(svn_cmd propget svn:eol-style hello.txt)" = "xnative" &&
|
|
|
|
test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
|
2008-07-25 23:32:37 +08:00
|
|
|
|
|
|
|
# Check properties from second commit.
|
2009-05-08 16:06:16 +08:00
|
|
|
test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
|
|
|
|
test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
|
|
|
|
test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
|
|
|
|
test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
|
|
|
|
test "x$(svn_cmd propget svn:mime-type zot)" = "x"
|
2008-09-07 09:29:12 +08:00
|
|
|
)
|
2008-07-25 23:32:37 +08:00
|
|
|
'
|
|
|
|
|
2008-09-07 09:50:38 +08:00
|
|
|
test_expect_success 'check renamed file' '
|
|
|
|
test -d user &&
|
|
|
|
generate_auto_props yes > user/config &&
|
|
|
|
git mv foo foo.sh &&
|
|
|
|
git commit -m "foo => foo.sh" &&
|
|
|
|
git svn dcommit --config-dir=user &&
|
|
|
|
(
|
|
|
|
cd work/svnrepo &&
|
2009-05-08 16:06:16 +08:00
|
|
|
svn_cmd up &&
|
2008-09-07 09:50:38 +08:00
|
|
|
test ! -e foo &&
|
|
|
|
test -e foo.sh &&
|
2009-05-08 16:06:16 +08:00
|
|
|
test "x$(svn_cmd propget svn:mime-type foo.sh)" = \
|
2008-09-07 09:50:38 +08:00
|
|
|
"xapplication/x-shellscript" &&
|
2009-05-08 16:06:16 +08:00
|
|
|
test "x$(svn_cmd propget svn:eol-style foo.sh)" = "xLF"
|
2008-09-07 09:50:38 +08:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2008-07-25 23:32:37 +08:00
|
|
|
test_done
|