From 57708cfcd3d031c5a5aafa0cfebb8e0559b7234d Mon Sep 17 00:00:00 2001 From: Andy Gurden Date: Tue, 7 Nov 2017 19:22:15 +0000 Subject: [PATCH] Initialize remote for export where needed whenever they are read from the repository. Fixes #1123 --- doc/release-notes/NEXT.md | 1 + src/GitTfs/Core/GitRepository.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/release-notes/NEXT.md b/doc/release-notes/NEXT.md index e69de29b..a5ea5bfa 100644 --- a/doc/release-notes/NEXT.md +++ b/doc/release-notes/NEXT.md @@ -0,0 +1 @@ +* Maintain export flag when resuming a clone for non-trunk branches (#1123) diff --git a/src/GitTfs/Core/GitRepository.cs b/src/GitTfs/Core/GitRepository.cs index b9c00977..c656bc88 100644 --- a/src/GitTfs/Core/GitRepository.cs +++ b/src/GitTfs/Core/GitRepository.cs @@ -8,6 +8,7 @@ using StructureMap; using LibGit2Sharp; using GitTfs.Commands; using Branch = LibGit2Sharp.Branch; +using GitTfs.Util; namespace GitTfs.Core { @@ -258,7 +259,17 @@ namespace GitTfs.Core { // does this need to ensuretfsauthenticated? _repository.Config.Set("tfs.touch", "1"); // reload configuration, because `git tfs init` and `git tfs clone` use Process.Start to update the config, so _repository's copy is out of date. - return _remoteConfigReader.Load(_repository.Config).Select(x => BuildRemote(x)).ToDictionary(x => x.Id); + var remotes = _remoteConfigReader.Load(_repository.Config).Select(x => BuildRemote(x)).ToDictionary(x => x.Id); + + bool shouldExport = GetConfig(GitTfsConstants.ExportMetadatasConfigKey) == "true"; + + foreach(var remote in remotes.Values) + { + var metadataExportInitializer = new ExportMetadatasInitializer(_globals); + metadataExportInitializer.InitializeRemote(remote, shouldExport); + } + + return remotes; } private IGitTfsRemote BuildRemote(RemoteInfo remoteInfo)