From 4049672e67310ffd49d2832f769e1bf874e798a2 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 4 Oct 2018 09:37:10 -0400 Subject: [PATCH 1/6] Adding extra logging to check if the path still exists when we go to write to it --- src/GitHub.Api/Installer/OctorunInstaller.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index e1f92252b..9766b7c99 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -52,8 +52,14 @@ private NPath GrabZipFromResources() private NPath MoveOctorun(NPath fromPath) { var toPath = installDetails.InstallationPath; + + Logger.Info("MoveOctorun fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); + toPath.DeleteIfExists(); toPath.EnsureParentDirectoryExists(); + + Logger.Info("toPath Exists: {0}", toPath.Exists()); + fromPath.Move(toPath); fromPath.Parent.Delete(); return installDetails.ExecutablePath; From ae4f4f650b5449f3e01ea9a7eb1837a785c0bb80 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 4 Oct 2018 09:54:58 -0400 Subject: [PATCH 2/6] Adding more logs --- src/GitHub.Api/Installer/GitInstaller.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Installer/GitInstaller.cs b/src/GitHub.Api/Installer/GitInstaller.cs index 4feb21c75..6d5734ceb 100644 --- a/src/GitHub.Api/Installer/GitInstaller.cs +++ b/src/GitHub.Api/Installer/GitInstaller.cs @@ -301,13 +301,17 @@ private GitInstallationState ExtractGit(GitInstallationState state) return true; }); unzipTask.Progress(p => Progress.UpdateProgress(40 + (long)(20 * p.Percentage), 100, unzipTask.Message)); - var path = unzipTask.RunSynchronously(); + var source = unzipTask.RunSynchronously(); var target = state.GitInstallationPath; if (unzipTask.Successful) { - var source = path; + Logger.Info("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); + target.DeleteIfExists(); target.EnsureParentDirectoryExists(); + + Logger.Info("target Exists: {0}", target.Exists()); + source.Move(target); state.GitIsValid = true; state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath; @@ -326,13 +330,17 @@ private GitInstallationState ExtractGit(GitInstallationState state) return true; }); unzipTask.Progress(p => Progress.UpdateProgress(60 + (long)(20 * p.Percentage), 100, unzipTask.Message)); - var path = unzipTask.RunSynchronously(); + var source = unzipTask.RunSynchronously(); var target = state.GitLfsInstallationPath; if (unzipTask.Successful) { - var source = path; + Logger.Info("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); + target.DeleteIfExists(); target.EnsureParentDirectoryExists(); + + Logger.Info("target Exists: {0}", target.Exists()); + source.Move(target); state.GitLfsIsValid = true; } From dba56321bffeab985f87fa61cd4c5c58e97c873a Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Thu, 4 Oct 2018 15:34:22 -0400 Subject: [PATCH 3/6] Trying to move the files into the target as opposed to moving the whole thing --- src/GitHub.Api/Installer/OctorunInstaller.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 9766b7c99..284ce9e11 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -55,13 +55,15 @@ private NPath MoveOctorun(NPath fromPath) Logger.Info("MoveOctorun fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); - toPath.DeleteIfExists(); - toPath.EnsureParentDirectoryExists(); + Logger.Info("DeleteContents toPath:{0}", toPath.ToString()); + toPath.DeleteContents(); - Logger.Info("toPath Exists: {0}", toPath.Exists()); + Logger.Info("MoveFiles fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); + fromPath.MoveFiles(toPath, true); - fromPath.Move(toPath); + Logger.Info("Delete fromPath:{0}", fromPath.ToString()); fromPath.Parent.Delete(); + return installDetails.ExecutablePath; } From 009a34a50758d24cb3880adf7e74ff59a62cd438 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 5 Oct 2018 09:52:11 -0400 Subject: [PATCH 4/6] Changing copy method of git and logs --- src/GitHub.Api/Installer/GitInstaller.cs | 15 +++++++++------ src/GitHub.Api/Installer/OctorunInstaller.cs | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/GitHub.Api/Installer/GitInstaller.cs b/src/GitHub.Api/Installer/GitInstaller.cs index 6d5734ceb..453f76335 100644 --- a/src/GitHub.Api/Installer/GitInstaller.cs +++ b/src/GitHub.Api/Installer/GitInstaller.cs @@ -307,12 +307,15 @@ private GitInstallationState ExtractGit(GitInstallationState state) { Logger.Info("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); - target.DeleteIfExists(); - target.EnsureParentDirectoryExists(); + Logger.Info("DeleteContents target:{0}", target.ToString()); + target.DeleteContents(); - Logger.Info("target Exists: {0}", target.Exists()); + Logger.Info("MoveFiles fromPath: {0} toPath:{1}", source.ToString(), target.ToString()); + source.MoveFiles(target, true); + + Logger.Info("Delete source:{0}", source.ToString()); + source.Delete(); - source.Move(target); state.GitIsValid = true; state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath; } @@ -334,12 +337,12 @@ private GitInstallationState ExtractGit(GitInstallationState state) var target = state.GitLfsInstallationPath; if (unzipTask.Successful) { - Logger.Info("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); + Logger.Info("Moving GitLFS source:{0} target:{1}", source.ToString(), target.ToString()); target.DeleteIfExists(); target.EnsureParentDirectoryExists(); - Logger.Info("target Exists: {0}", target.Exists()); + Logger.Info("GitLFS target Exists: {0}", target.Exists()); source.Move(target); state.GitLfsIsValid = true; diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 284ce9e11..0d483a2ad 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -61,7 +61,7 @@ private NPath MoveOctorun(NPath fromPath) Logger.Info("MoveFiles fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); fromPath.MoveFiles(toPath, true); - Logger.Info("Delete fromPath:{0}", fromPath.ToString()); + Logger.Info("Delete fromPath.Parent:{0}", fromPath.Parent.ToString()); fromPath.Parent.Delete(); return installDetails.ExecutablePath; From 4dacb26907d30a2addaa6ccf7028698739f9007f Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 5 Oct 2018 10:41:51 -0400 Subject: [PATCH 5/6] Moving LFS the same way --- src/GitHub.Api/Installer/GitInstaller.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/GitHub.Api/Installer/GitInstaller.cs b/src/GitHub.Api/Installer/GitInstaller.cs index 453f76335..5fcb992a3 100644 --- a/src/GitHub.Api/Installer/GitInstaller.cs +++ b/src/GitHub.Api/Installer/GitInstaller.cs @@ -317,6 +317,7 @@ private GitInstallationState ExtractGit(GitInstallationState state) source.Delete(); state.GitIsValid = true; + state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath; } } @@ -339,12 +340,15 @@ private GitInstallationState ExtractGit(GitInstallationState state) { Logger.Info("Moving GitLFS source:{0} target:{1}", source.ToString(), target.ToString()); - target.DeleteIfExists(); - target.EnsureParentDirectoryExists(); + Logger.Info("DeleteContents target:{0}", target.ToString()); + target.DeleteContents(); + + Logger.Info("MoveFiles fromPath: {0} toPath:{1}", source.ToString(), target.ToString()); + source.MoveFiles(target, true); - Logger.Info("GitLFS target Exists: {0}", target.Exists()); + Logger.Info("Delete source:{0}", source.ToString()); + source.Delete(); - source.Move(target); state.GitLfsIsValid = true; } } From ff93b0e85d720aaba2237e73c6e50e7d5c877f8f Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Fri, 5 Oct 2018 10:49:26 -0400 Subject: [PATCH 6/6] Cleanup --- src/GitHub.Api/Installer/GitInstaller.cs | 18 ++++-------------- src/GitHub.Api/Installer/OctorunInstaller.cs | 7 +------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/GitHub.Api/Installer/GitInstaller.cs b/src/GitHub.Api/Installer/GitInstaller.cs index 5fcb992a3..71dd77361 100644 --- a/src/GitHub.Api/Installer/GitInstaller.cs +++ b/src/GitHub.Api/Installer/GitInstaller.cs @@ -305,16 +305,11 @@ private GitInstallationState ExtractGit(GitInstallationState state) var target = state.GitInstallationPath; if (unzipTask.Successful) { - Logger.Info("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); + Logger.Trace("Moving Git source:{0} target:{1}", source.ToString(), target.ToString()); - Logger.Info("DeleteContents target:{0}", target.ToString()); target.DeleteContents(); - - Logger.Info("MoveFiles fromPath: {0} toPath:{1}", source.ToString(), target.ToString()); source.MoveFiles(target, true); - - Logger.Info("Delete source:{0}", source.ToString()); - source.Delete(); + source.Parent.Delete(); state.GitIsValid = true; @@ -338,16 +333,11 @@ private GitInstallationState ExtractGit(GitInstallationState state) var target = state.GitLfsInstallationPath; if (unzipTask.Successful) { - Logger.Info("Moving GitLFS source:{0} target:{1}", source.ToString(), target.ToString()); + Logger.Trace("Moving GitLFS source:{0} target:{1}", source.ToString(), target.ToString()); - Logger.Info("DeleteContents target:{0}", target.ToString()); target.DeleteContents(); - - Logger.Info("MoveFiles fromPath: {0} toPath:{1}", source.ToString(), target.ToString()); source.MoveFiles(target, true); - - Logger.Info("Delete source:{0}", source.ToString()); - source.Delete(); + source.Parent.Delete(); state.GitLfsIsValid = true; } diff --git a/src/GitHub.Api/Installer/OctorunInstaller.cs b/src/GitHub.Api/Installer/OctorunInstaller.cs index 0d483a2ad..9baaca033 100644 --- a/src/GitHub.Api/Installer/OctorunInstaller.cs +++ b/src/GitHub.Api/Installer/OctorunInstaller.cs @@ -53,15 +53,10 @@ private NPath MoveOctorun(NPath fromPath) { var toPath = installDetails.InstallationPath; - Logger.Info("MoveOctorun fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); + Logger.Trace("MoveOctorun fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); - Logger.Info("DeleteContents toPath:{0}", toPath.ToString()); toPath.DeleteContents(); - - Logger.Info("MoveFiles fromPath: {0} toPath:{1}", fromPath.ToString(), toPath.ToString()); fromPath.MoveFiles(toPath, true); - - Logger.Info("Delete fromPath.Parent:{0}", fromPath.Parent.ToString()); fromPath.Parent.Delete(); return installDetails.ExecutablePath;