{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/63572377","id":63572377,"diff_hunk":"@@ -0,0 +1,56 @@\n+/*\n+ *\n+ */\n+package hudson;\n+\n+import static org.junit.Assert.assertTrue;\n+import static org.junit.Assume.assumeTrue;\n+\n+import java.io.File;\n+import org.junit.Before;\n+import org.junit.Rule;\n+import org.junit.Test;\n+import org.junit.rules.TemporaryFolder;\n+import org.jvnet.hudson.test.Issue;\n+\n+public class RemoveWindowsDirectoryJunctionTest {\n+    @Rule\n+    public TemporaryFolder tmp = new TemporaryFolder();\n+\n+    @Before\n+    public void windowsOnly() {\n+       assumeTrue(File.pathSeparatorChar==';');\n+    }\n+\n+    @Test\n+    @Issue(\"JENKINS-2995\")\n+    public void testJunctionIsRemovedButNotContents() throws Exception {\n+        TemporaryFolder dir1 = new TemporaryFolder(tmp.getRoot());\n+        dir1.create();\n+        File dir1Root = dir1.getRoot();\n+        File f1 = dir1.newFile();\n+        File j1 = makeJunction(tmp.getRoot(), dir1Root);\n+        print(tmp.getRoot());\n+        print(dir1Root);\n+        print(j1);\n+        Util.deleteRecursive(j1);\n+        print(dir1Root);\n+        print(tmp.getRoot());\n+        assertTrue(f1.exists());\n+    }\n+\n+    private File makeJunction(File baseDir, File pointToDir) throws Exception {\n+       File junc = new File(baseDir, \"testJunction\");\n+       Process p = Runtime.getRuntime().exec(\"cmd.exe /C \\\"mklink /J \" + junc.getPath() + \" \" + pointToDir.getPath() + \"\\\"\");","path":"core/src/test/java/hudson/RemoveWindowsDirectoryJunctionTest.java","position":45,"original_position":44,"commit_id":"d6b21852615e25527eaf10c14e973370779d45fd","original_commit_id":"a9ae381c7762e4cd7918b872fd0051187b6a27bd","user":{"login":"dbroady1","id":6976281,"avatar_url":"https://avatars.githubusercontent.com/u/6976281?v=3","gravatar_id":"","url":"https://api.github.com/users/dbroady1","html_url":"https://github.com/dbroady1","followers_url":"https://api.github.com/users/dbroady1/followers","following_url":"https://api.github.com/users/dbroady1/following{/other_user}","gists_url":"https://api.github.com/users/dbroady1/gists{/gist_id}","starred_url":"https://api.github.com/users/dbroady1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbroady1/subscriptions","organizations_url":"https://api.github.com/users/dbroady1/orgs","repos_url":"https://api.github.com/users/dbroady1/repos","events_url":"https://api.github.com/users/dbroady1/events{/privacy}","received_events_url":"https://api.github.com/users/dbroady1/received_events","type":"User","site_admin":false},"body":"According to http://ss64.com/nt/syntax-internal.html, mklink is an internal cmd.exe command, not an external exe.  So, my use of cmd.exe /c \"mklink /J ...\" is correct.  I will fix it so that it will work with spaces in the path name, however.","created_at":"2016-05-17T17:58:19Z","updated_at":"2016-05-17T17:58:19Z","html_url":"https://github.com/jenkinsci/jenkins/pull/1787#discussion_r63572377","pull_request_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments/63572377"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/1787#discussion_r63572377"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787","id":41830568,"html_url":"https://github.com/jenkinsci/jenkins/pull/1787","diff_url":"https://github.com/jenkinsci/jenkins/pull/1787.diff","patch_url":"https://github.com/jenkinsci/jenkins/pull/1787.patch","issue_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/1787","number":1787,"state":"open","locked":false,"title":"[JENKINS-29956] Test Windows junctions before Java 7 symlink","user":{"login":"dbroady1","id":6976281,"avatar_url":"https://avatars.githubusercontent.com/u/6976281?v=3","gravatar_id":"","url":"https://api.github.com/users/dbroady1","html_url":"https://github.com/dbroady1","followers_url":"https://api.github.com/users/dbroady1/followers","following_url":"https://api.github.com/users/dbroady1/following{/other_user}","gists_url":"https://api.github.com/users/dbroady1/gists{/gist_id}","starred_url":"https://api.github.com/users/dbroady1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbroady1/subscriptions","organizations_url":"https://api.github.com/users/dbroady1/orgs","repos_url":"https://api.github.com/users/dbroady1/repos","events_url":"https://api.github.com/users/dbroady1/events{/privacy}","received_events_url":"https://api.github.com/users/dbroady1/received_events","type":"User","site_admin":false},"body":"Apparently Java 7 (and later) do not count Windows junctions as\r\nsymlinks.  When you drill down into the BasicFileAttributes structure,\r\nreparse points are only counted under isOther.  So, since we already\r\nhave code that properly detects Windows Junctions, let's use that first\r\nand then fallback to the Java 7 code.","created_at":"2015-08-06T20:25:07Z","updated_at":"2016-05-17T17:58:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6fdb960e633dc20bd1e8e2f8202bfa1d42a34556","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/1787/comments","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/d6b21852615e25527eaf10c14e973370779d45fd","head":{"label":"dbroady1:FixWindowsJunctionTestInIsSymlink","ref":"FixWindowsJunctionTestInIsSymlink","sha":"d6b21852615e25527eaf10c14e973370779d45fd","user":{"login":"dbroady1","id":6976281,"avatar_url":"https://avatars.githubusercontent.com/u/6976281?v=3","gravatar_id":"","url":"https://api.github.com/users/dbroady1","html_url":"https://github.com/dbroady1","followers_url":"https://api.github.com/users/dbroady1/followers","following_url":"https://api.github.com/users/dbroady1/following{/other_user}","gists_url":"https://api.github.com/users/dbroady1/gists{/gist_id}","starred_url":"https://api.github.com/users/dbroady1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbroady1/subscriptions","organizations_url":"https://api.github.com/users/dbroady1/orgs","repos_url":"https://api.github.com/users/dbroady1/repos","events_url":"https://api.github.com/users/dbroady1/events{/privacy}","received_events_url":"https://api.github.com/users/dbroady1/received_events","type":"User","site_admin":false},"repo":{"id":40325003,"name":"jenkins","full_name":"dbroady1/jenkins","owner":{"login":"dbroady1","id":6976281,"avatar_url":"https://avatars.githubusercontent.com/u/6976281?v=3","gravatar_id":"","url":"https://api.github.com/users/dbroady1","html_url":"https://github.com/dbroady1","followers_url":"https://api.github.com/users/dbroady1/followers","following_url":"https://api.github.com/users/dbroady1/following{/other_user}","gists_url":"https://api.github.com/users/dbroady1/gists{/gist_id}","starred_url":"https://api.github.com/users/dbroady1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbroady1/subscriptions","organizations_url":"https://api.github.com/users/dbroady1/orgs","repos_url":"https://api.github.com/users/dbroady1/repos","events_url":"https://api.github.com/users/dbroady1/events{/privacy}","received_events_url":"https://api.github.com/users/dbroady1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dbroady1/jenkins","description":"Jenkins Continuous Integration Server","fork":true,"url":"https://api.github.com/repos/dbroady1/jenkins","forks_url":"https://api.github.com/repos/dbroady1/jenkins/forks","keys_url":"https://api.github.com/repos/dbroady1/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dbroady1/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dbroady1/jenkins/teams","hooks_url":"https://api.github.com/repos/dbroady1/jenkins/hooks","issue_events_url":"https://api.github.com/repos/dbroady1/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/dbroady1/jenkins/events","assignees_url":"https://api.github.com/repos/dbroady1/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/dbroady1/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/dbroady1/jenkins/tags","blobs_url":"https://api.github.com/repos/dbroady1/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dbroady1/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dbroady1/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/dbroady1/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dbroady1/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/dbroady1/jenkins/languages","stargazers_url":"https://api.github.com/repos/dbroady1/jenkins/stargazers","contributors_url":"https://api.github.com/repos/dbroady1/jenkins/contributors","subscribers_url":"https://api.github.com/repos/dbroady1/jenkins/subscribers","subscription_url":"https://api.github.com/repos/dbroady1/jenkins/subscription","commits_url":"https://api.github.com/repos/dbroady1/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/dbroady1/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/dbroady1/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/dbroady1/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/dbroady1/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/dbroady1/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dbroady1/jenkins/merges","archive_url":"https://api.github.com/repos/dbroady1/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dbroady1/jenkins/downloads","issues_url":"https://api.github.com/repos/dbroady1/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/dbroady1/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/dbroady1/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/dbroady1/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dbroady1/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/dbroady1/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/dbroady1/jenkins/deployments","created_at":"2015-08-06T20:17:38Z","updated_at":"2015-08-06T20:18:02Z","pushed_at":"2016-05-17T17:46:19Z","git_url":"git://github.com/dbroady1/jenkins.git","ssh_url":"git@github.com:dbroady1/jenkins.git","clone_url":"https://github.com/dbroady1/jenkins.git","svn_url":"https://github.com/dbroady1/jenkins","homepage":"http://jenkins-ci.org/","size":85049,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:master","ref":"master","sha":"be2787ad5e3164a2c4417a40d4ad48465756effc","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":1103607,"name":"jenkins","full_name":"jenkinsci/jenkins","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/jenkins","description":"Jenkins Continuous Integration Server","fork":true,"url":"https://api.github.com/repos/jenkinsci/jenkins","forks_url":"https://api.github.com/repos/jenkinsci/jenkins/forks","keys_url":"https://api.github.com/repos/jenkinsci/jenkins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/jenkins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/jenkins/teams","hooks_url":"https://api.github.com/repos/jenkinsci/jenkins/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/jenkins/events","assignees_url":"https://api.github.com/repos/jenkinsci/jenkins/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/jenkins/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/jenkins/tags","blobs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/jenkins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/jenkins/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/jenkins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/jenkins/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/jenkins/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/jenkins/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/jenkins/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/jenkins/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/jenkins/subscription","commits_url":"https://api.github.com/repos/jenkinsci/jenkins/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/jenkins/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/jenkins/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/jenkins/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/jenkins/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/jenkins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/jenkins/merges","archive_url":"https://api.github.com/repos/jenkinsci/jenkins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/jenkins/downloads","issues_url":"https://api.github.com/repos/jenkinsci/jenkins/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/jenkins/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/jenkins/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/jenkins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/jenkins/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/jenkins/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/jenkins/deployments","created_at":"2010-11-22T21:21:23Z","updated_at":"2016-05-17T16:54:59Z","pushed_at":"2016-05-17T17:46:23Z","git_url":"git://github.com/jenkinsci/jenkins.git","ssh_url":"git@github.com:jenkinsci/jenkins.git","clone_url":"https://github.com/jenkinsci/jenkins.git","svn_url":"https://github.com/jenkinsci/jenkins","homepage":"http://jenkins-ci.org/","size":138141,"stargazers_count":5833,"watchers_count":5833,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":2514,"mirror_url":null,"open_issues_count":120,"forks":2514,"open_issues":120,"watchers":5833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787"},"html":{"href":"https://github.com/jenkinsci/jenkins/pull/1787"},"issue":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/1787"},"comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/issues/1787/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/jenkins/pulls/1787/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/jenkins/statuses/d6b21852615e25527eaf10c14e973370779d45fd"}}}}