2008-07-25 19:32:37 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2008 Brad King
|
|
|
|
|
2008-09-08 14:02:08 +04:00
|
|
|
test_description='git svn dcommit honors auto-props'
|
2008-07-25 19:32:37 +04: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 01:25:27 +04:00
|
|
|
test_expect_success 'initialize git svn' '
|
2008-07-25 19:32:37 +04:00
|
|
|
mkdir import &&
|
|
|
|
(
|
|
|
|
cd import &&
|
|
|
|
echo foo >foo &&
|
2009-05-08 12:06:16 +04:00
|
|
|
svn_cmd import -m "import for git svn" . "$svnrepo"
|
2008-07-25 19:32:37 +04:00
|
|
|
) &&
|
|
|
|
rm -rf import &&
|
2010-10-31 04:46:54 +03:00
|
|
|
git svn init "$svnrepo" &&
|
2008-09-08 14:02:08 +04:00
|
|
|
git svn fetch
|
2008-07-25 19:32:37 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'enable auto-props config' '
|
|
|
|
mkdir user &&
|
|
|
|
generate_auto_props yes >user/config
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'add files matching auto-props' '
|
2016-01-27 19:20:15 +03:00
|
|
|
write_script exec1.sh </dev/null &&
|
2008-07-25 19:32:37 +04:00
|
|
|
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' '
|
2016-01-27 19:20:15 +03:00
|
|
|
write_script exec2.sh </dev/null &&
|
2008-07-25 19:32:37 +04:00
|
|
|
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 05:29:12 +04:00
|
|
|
(
|
2008-07-25 19:32:37 +04:00
|
|
|
mkdir work &&
|
|
|
|
cd work &&
|
2009-05-08 12:06:16 +04:00
|
|
|
svn_cmd co "$svnrepo" &&
|
2008-07-25 19:32:37 +04:00
|
|
|
cd svnrepo &&
|
|
|
|
|
|
|
|
# Check properties from first commit.
|
2016-01-27 19:20:15 +03:00
|
|
|
if test_have_prereq POSIXPERM
|
|
|
|
then
|
|
|
|
test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
|
|
|
|
fi &&
|
2009-05-08 12:06:16 +04:00
|
|
|
test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
|
2008-07-25 19:32:37 +04:00
|
|
|
"xapplication/x-shellscript" &&
|
2009-05-08 12:06:16 +04: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 19:32:37 +04:00
|
|
|
|
|
|
|
# Check properties from second commit.
|
2016-01-27 19:20:15 +03:00
|
|
|
if test_have_prereq POSIXPERM
|
|
|
|
then
|
|
|
|
test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
|
|
|
|
fi &&
|
2009-05-08 12:06:16 +04:00
|
|
|
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 05:29:12 +04:00
|
|
|
)
|
2008-07-25 19:32:37 +04:00
|
|
|
'
|
|
|
|
|
2008-09-07 05:50:38 +04: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 12:06:16 +04:00
|
|
|
svn_cmd up &&
|
2008-09-07 05:50:38 +04:00
|
|
|
test ! -e foo &&
|
|
|
|
test -e foo.sh &&
|
2009-05-08 12:06:16 +04:00
|
|
|
test "x$(svn_cmd propget svn:mime-type foo.sh)" = \
|
2008-09-07 05:50:38 +04:00
|
|
|
"xapplication/x-shellscript" &&
|
2009-05-08 12:06:16 +04:00
|
|
|
test "x$(svn_cmd propget svn:eol-style foo.sh)" = "xLF"
|
2008-09-07 05:50:38 +04:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2008-07-25 19:32:37 +04:00
|
|
|
test_done
|