Skip to content

Commit

Permalink
Initialize remote for export where needed whenever they are read from…
Browse files Browse the repository at this point in the history
… the repository. Fixes #1123
  • Loading branch information
Andy Gurden committed Nov 7, 2017
1 parent 800169a commit 57708cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/release-notes/NEXT.md
@@ -0,0 +1 @@
* Maintain export flag when resuming a clone for non-trunk branches (#1123)
13 changes: 12 additions & 1 deletion src/GitTfs/Core/GitRepository.cs
Expand Up @@ -8,6 +8,7 @@
using LibGit2Sharp;
using GitTfs.Commands;
using Branch = LibGit2Sharp.Branch;
using GitTfs.Util;

namespace GitTfs.Core
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 57708cf

Please sign in to comment.