Skip to content

git-svn test fixes #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion compat/mingw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,12 @@ int mingw_rename(const char *pold, const char *pnew)
if (gle == ERROR_ACCESS_DENIED &&
(attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
errno = EISDIR;
DWORD attrsold = GetFileAttributesW(wpold);
if (attrsold == INVALID_FILE_ATTRIBUTES ||
!(attrsold & FILE_ATTRIBUTE_DIRECTORY))
errno = EISDIR;
else if (!_wrmdir(wpnew))
goto repeat;
return -1;
}
if ((attrs & FILE_ATTRIBUTE_READONLY) &&
Expand Down
35 changes: 22 additions & 13 deletions t/t9100-git-svn-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ test_expect_success \
mkdir bar &&
echo "zzz" >bar/zzz &&
echo "#!/bin/sh" >exec.sh &&
chmod +x exec.sh &&
{
test_have_prereq !POSIXPERM ||
chmod +x exec.sh
} &&
echo "utf-8" >utf-8.file &&
svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
) &&
rm -rf import &&
Expand Down Expand Up @@ -117,7 +121,7 @@ test_expect_success "$name" '


name='remove executable bit from a file'
test_expect_success "$name" '
test_expect_success !MINGW "$name" '
rm -f "$GIT_DIR"/index &&
git checkout -f -b mybranch5 ${remotes_git_svn} &&
chmod -x exec.sh &&
Expand All @@ -130,7 +134,7 @@ test_expect_success "$name" '


name='add executable bit back file'
test_expect_success "$name" '
test_expect_success !MINGW "$name" '
chmod +x exec.sh &&
git update-index exec.sh &&
git commit -m "$name" &&
Expand All @@ -141,7 +145,7 @@ test_expect_success "$name" '


name='executable file becomes a symlink to file'
test_expect_success "$name" '
test_expect_success !MINGW "$name" '
rm exec.sh &&
ln -s file exec.sh &&
git update-index exec.sh &&
Expand All @@ -153,8 +157,11 @@ test_expect_success "$name" '

name='new symlink is added to a file that was also just made executable'

test_expect_success "$name" '
chmod +x file &&
test_expect_success !MINGW "$name" '
{
test_have_prereq !POSIXPERM ||
chmod +x file
} &&
ln -s file exec-2.sh &&
git update-index --add file exec-2.sh &&
git commit -m "$name" &&
Expand All @@ -165,7 +172,7 @@ test_expect_success "$name" '
test -h "$SVN_TREE"/exec-2.sh'

name='modify a symlink to become a file'
test_expect_success "$name" '
test_expect_success !MINGW "$name" '
echo git help >help &&
rm exec-2.sh &&
cp help exec-2.sh &&
Expand All @@ -181,11 +188,13 @@ test_expect_success "$name" '
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
LC_ALL="$GIT_SVN_LC_ALL"
export LC_ALL
test_expect_success UTF8 "$name" "
echo '# hello' >> exec-2.sh &&
git update-index exec-2.sh &&
git commit -m 'éï∏' &&
git svn set-tree HEAD"
test_expect_success UTF8 "$name" '
rm -f "$GIT_DIR"/index &&
git checkout -f -b mybranch5 ${remotes_git_svn} &&
echo "# hello" >> utf-8.file &&
git update-index utf-8.file &&
git commit -m "éï∏" &&
git svn set-tree HEAD'
unset LC_ALL

name='test fetch functionality (svn => git) with alternate GIT_SVN_ID'
Expand Down Expand Up @@ -214,7 +223,7 @@ tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
EOF

test_expect_success "$name" "test_cmp a expected"
test_expect_success !MINGW "$name" "test_cmp a expected"

test_expect_success 'exit if remote refs are ambigious' "
git config --add svn-remote.svn.fetch \
Expand Down
12 changes: 9 additions & 3 deletions t/t9118-git-svn-funky-branch-names.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ test_expect_success 'setup svnrepo' '
"$svnrepo/pr ject/branches/$scary_uri" &&
svn_cmd cp -m "leading dot" "$svnrepo/pr ject/trunk" \
"$svnrepo/pr ject/branches/.leading_dot" &&
svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
"$svnrepo/pr ject/branches/trailing_dot." &&
{
test_have_prereq MINGW ||
svn_cmd cp -m "trailing dot" "$svnrepo/pr ject/trunk" \
"$svnrepo/pr ject/branches/trailing_dot."
} &&
svn_cmd cp -m "trailing .lock" "$svnrepo/pr ject/trunk" \
"$svnrepo/pr ject/branches/trailing_dotlock.lock" &&
svn_cmd cp -m "reflog" "$svnrepo/pr ject/trunk" \
Expand All @@ -45,7 +48,10 @@ test_expect_success 'test clone with funky branch names' '
git rev-parse "refs/remotes/origin/more%20fun%20plugin!" &&
git rev-parse "refs/remotes/origin/$scary_ref" &&
git rev-parse "refs/remotes/origin/%2Eleading_dot" &&
git rev-parse "refs/remotes/origin/trailing_dot%2E" &&
{
test_have_prereq MINGW ||
git rev-parse "refs/remotes/origin/trailing_dot%2E"
} &&
git rev-parse "refs/remotes/origin/trailing_dotlock%2Elock" &&
git rev-parse "refs/remotes/origin/$non_reflog"
)
Expand Down
20 changes: 16 additions & 4 deletions t/t9124-git-svn-dcommit-auto-props.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ test_expect_success 'enable auto-props config' '

test_expect_success 'add files matching auto-props' '
echo "#!$SHELL_PATH" >exec1.sh &&
chmod +x exec1.sh &&
{
test_have_prereq !POSIXPERM ||
chmod +x exec1.sh
} &&
echo "hello" >hello.txt &&
echo bar >bar &&
git add exec1.sh hello.txt bar &&
Expand All @@ -49,7 +52,10 @@ test_expect_success 'disable auto-props config' '

test_expect_success 'add files matching disabled auto-props' '
echo "#$SHELL_PATH" >exec2.sh &&
chmod +x exec2.sh &&
{
test_have_prereq !POSIXPERM ||
chmod +x exec2.sh
} &&
echo "world" >world.txt &&
echo zot >zot &&
git add exec2.sh world.txt zot &&
Expand All @@ -65,15 +71,21 @@ test_expect_success 'check resulting svn repository' '
cd svnrepo &&

# Check properties from first commit.
test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" &&
{
test_have_prereq !POSIXPERM ||
test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
} &&
test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
"xapplication/x-shellscript" &&
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" &&

# Check properties from second commit.
test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" &&
{
test_have_prereq !POSIXPERM ||
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" &&
Expand Down
2 changes: 1 addition & 1 deletion t/t9130-git-svn-authors-file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test_expect_success 'fetch continues after authors-file is fixed' '
)
'

test_expect_success 'fresh clone with svn.authors-file in config' '
test_expect_success !MINGW 'fresh clone with svn.authors-file in config' '
(
rm -r "$GIT_DIR" &&
test x = x"$(git config svn.authorsfile)" &&
Expand Down