diff --git a/doc/release-notes/NEXT.md b/doc/release-notes/NEXT.md index e69de29bb..a5ea5bfac 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 b9c009772..c656bc885 100644 --- a/src/GitTfs/Core/GitRepository.cs +++ b/src/GitTfs/Core/GitRepository.cs @@ -8,6 +8,7 @@ using LibGit2Sharp; using GitTfs.Commands; using Branch = LibGit2Sharp.Branch; +using GitTfs.Util; namespace GitTfs.Core { @@ -258,7 +259,17 @@ public Branch RenameBranch(string oldName, string newName) { // 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)