Skip to content

Commit

Permalink
Better copy the author file just after the creation of the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiossec committed Jan 5, 2018
1 parent bbb9352 commit 19cd3b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 10 additions & 1 deletion src/GitTfs/Commands/Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Text.RegularExpressions;
using NDesk.Options;
using GitTfs.Core;
using GitTfs.Util;
using StructureMap;

namespace GitTfs.Commands
Expand All @@ -18,11 +19,13 @@ public class Init : GitTfsCommand
private readonly RemoteOptions _remoteOptions;
private readonly Globals _globals;
private readonly IGitHelpers _gitHelper;
private readonly AuthorsFile _authorsFileHelper;

public Init(RemoteOptions remoteOptions, InitOptions initOptions, Globals globals, IGitHelpers gitHelper)
public Init(RemoteOptions remoteOptions, InitOptions initOptions, Globals globals, IGitHelpers gitHelper, AuthorsFile authorsFileHelper)
{
_remoteOptions = remoteOptions;
_gitHelper = gitHelper;
_authorsFileHelper = authorsFileHelper;
_globals = globals;
_initOptions = initOptions;
}
Expand All @@ -46,11 +49,17 @@ public int Run(string tfsUrl, string tfsRepositoryPath)
{
tfsRepositoryPath.AssertValidTfsPathOrRoot();
DoGitInitDb();
SaveAuthorFileInRepository();
CommitTheGitIgnoreFile(_initOptions.GitIgnorePath);
GitTfsInit(tfsUrl, tfsRepositoryPath);
return 0;
}

private void SaveAuthorFileInRepository()
{
_authorsFileHelper.SaveAuthorFileInRepository(_globals.AuthorsFilePath, _globals.GitDir);
}

private void CommitTheGitIgnoreFile(string pathToGitIgnoreFile)
{
if (string.IsNullOrWhiteSpace(pathToGitIgnoreFile))
Expand Down
5 changes: 0 additions & 5 deletions src/GitTfs/GitTfs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ private void ParseAuthorsAndSave(bool couldSaveAuthorFile)
}
}

private void SaveAuthorFileInRepository()
{
_container.GetInstance<AuthorsFile>().SaveAuthorFileInRepository(_globals.AuthorsFilePath, _globals.GitDir);
}

public void InitializeGlobals()
{
var git = _container.GetInstance<IGitHelpers>();
Expand Down

0 comments on commit 19cd3b8

Please sign in to comment.