From dbcf1291c798e804d37b1c35030a694d161d7a4a Mon Sep 17 00:00:00 2001 From: Philippe Miossec Date: Thu, 6 Mar 2014 18:23:19 +0100 Subject: [PATCH] Prevent a crash during path verification Swallow TFS exceptions for this non critical part of the clone process... Permit to clone a branch and use git-tfs even when, due to a bug in TFS, TFS is broken and return an error TF14045 when asking for branches. --- GitTfs/Commands/Clone.cs | 13 ++++++++++++- doc/release-notes/NEXT.md | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/GitTfs/Commands/Clone.cs b/GitTfs/Commands/Clone.cs index c1db04cc..d373283a 100644 --- a/GitTfs/Commands/Clone.cs +++ b/GitTfs/Commands/Clone.cs @@ -103,7 +103,9 @@ namespace Sep.Git.Tfs.Commands private void VerifyTfsPathToClone(string tfsRepositoryPath) { - if (initBranch != null) + if (initBranch == null) + return; + try { var remote = globals.Repository.ReadTfsRemote(GitTfsConstants.DefaultRepositoryId); @@ -145,6 +147,15 @@ namespace Sep.Git.Tfs.Commands + " => If you want to manage branches with git-tfs, clone " + tfsTrunkRepositoryPath + " with '--with-branches' option instead...)"); } } + catch (GitTfsException) + { + throw; + } + catch (Exception ex) + { + stdout.WriteLine("warning: a server error occurs when trying to verify the tfs path cloned:\n " + ex.Message + + "\n try to continue anyway..."); + } } private static bool InitGitDir(string gitRepositoryPath) diff --git a/doc/release-notes/NEXT.md b/doc/release-notes/NEXT.md index ec1b5148..380b4e8e 100644 --- a/doc/release-notes/NEXT.md +++ b/doc/release-notes/NEXT.md @@ -5,4 +5,4 @@ * Use LibGit2Sharp to create commits (#534, #546) * Correct Tfs remote returned when using option `rcheckin -I` in the case of a merge commit and fix #543 where unable to fetch after deleting a tfs branch (#548) -* Other documentation and bug fixes (#487, #521, #523, #527) +* Other documentation and bug fixes (#487, #521, #523, #527, #557)