From b21b54cfcce4a217c947ee6db648d2fe91a9b37c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= Date: Thu, 5 Mar 2015 12:17:46 +0100 Subject: [PATCH 1/2] mingw: git-svn tests adaption. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are some issues with the git-svn test cases when they are beeing run on windows under a MINGW build. Some things are not available like the changing of the execute flag of shell scripts via the chmod command. Also there were problems with folder names that end with a dot on windows. Signed-off-by: 마누엘 --- t/t9100-git-svn-basic.sh | 35 +++++++++++++++++---------- t/t9118-git-svn-funky-branch-names.sh | 12 ++++++--- t/t9124-git-svn-dcommit-auto-props.sh | 20 ++++++++++++--- t/t9130-git-svn-authors-file.sh | 2 +- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 4fea8d901bbc0f..949287b63b4d23 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -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 && @@ -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 && @@ -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" && @@ -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 && @@ -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" && @@ -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 && @@ -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' @@ -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 \ diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh index ed4d1369cca6a2..73d98e70411cd1 100755 --- a/t/t9118-git-svn-funky-branch-names.sh +++ b/t/t9118-git-svn-funky-branch-names.sh @@ -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" \ @@ -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" ) diff --git a/t/t9124-git-svn-dcommit-auto-props.sh b/t/t9124-git-svn-dcommit-auto-props.sh index aa841e12996aad..c851121d6b8fc5 100755 --- a/t/t9124-git-svn-dcommit-auto-props.sh +++ b/t/t9124-git-svn-dcommit-auto-props.sh @@ -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 && @@ -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 && @@ -65,7 +71,10 @@ 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" && @@ -73,7 +82,10 @@ test_expect_success 'check resulting svn repository' ' 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" && diff --git a/t/t9130-git-svn-authors-file.sh b/t/t9130-git-svn-authors-file.sh index c44de267a1c0e2..0a9cd87136a7c7 100755 --- a/t/t9130-git-svn-authors-file.sh +++ b/t/t9130-git-svn-authors-file.sh @@ -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)" && From 879e40fe4ccc1b88cdeb2148cb29b63a68dffaf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= Date: Fri, 6 Mar 2015 12:09:51 +0100 Subject: [PATCH 2/2] mingw: Try to delete target directory first. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the rename function tries to move a directory it fails if the target directory exists. It should check if it can delete the (possibly empty) target directory and then try again to move the directory. Helped-by: Johannes Schindelin Signed-off-by: 마누엘 --- compat/mingw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index fac8a11cf30654..ad9e3311a6f8ba 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -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) &&