Skip to content

Commit

Permalink
Merge pull request #280 from pmiossec/remove_git_call_for_set_config
Browse files Browse the repository at this point in the history
Remove call to git command to set config (use libgit2sharp instead)
  • Loading branch information
sc68cal committed Jan 7, 2013
2 parents 7d6229a + a2e3184 commit 2270c1b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions GitTfs/Commands/Init.cs
Expand Up @@ -81,8 +81,8 @@ private string[] BuildInitCommand()

private void GitTfsInit(string tfsUrl, string tfsRepositoryPath)
{
gitHelper.SetConfig("core.autocrlf", initOptions.GitInitAutoCrlf);
gitHelper.SetConfig("core.ignorecase", "false");
globals.Repository.SetConfig("core.autocrlf", initOptions.GitInitAutoCrlf);
globals.Repository.SetConfig("core.ignorecase", "false");
globals.Repository.CreateTfsRemote(globals.RemoteId, tfsUrl, tfsRepositoryPath, remoteOptions);
}
}
Expand Down
7 changes: 6 additions & 1 deletion GitTfs/Core/GitRepository.cs
Expand Up @@ -157,9 +157,14 @@ public void CreateTfsRemote(string remoteId, string tfsUrl, string tfsRepository
_cachedRemotes = null;
}

public void SetConfig(string key, object value)
{
_repository.Config.Set(key, value.ToString());
}

private void SetTfsConfig(string remoteId, string subkey, object value)
{
this.SetConfig(_globals.RemoteConfigKey(remoteId, subkey), value);
SetConfig(_globals.RemoteConfigKey(remoteId, subkey), value);
}

private void ParseRemoteConfig(TextReader stdout, IDictionary<string, IGitTfsRemote> remotes)
Expand Down
8 changes: 0 additions & 8 deletions GitTfs/Core/IGitHelpers.cs
Expand Up @@ -14,12 +14,4 @@ public interface IGitHelpers
void WrapGitCommandErrors(string exceptionMessage, Action action);
IGitRepository MakeRepository(string dir);
}

public static partial class Ext
{
public static void SetConfig(this IGitHelpers gitHelpers, string configKey, object value)
{
gitHelpers.CommandNoisy("config", configKey, value.ToString());
}
}
}
1 change: 1 addition & 0 deletions GitTfs/Core/IGitRepository.cs
Expand Up @@ -8,6 +8,7 @@ public interface IGitRepository : IGitHelpers
{
string GitDir { get; set; }
string GetConfig(string key);
void SetConfig(string key, object value);
IEnumerable<IGitTfsRemote> ReadAllTfsRemotes();
IGitTfsRemote ReadTfsRemote(string remoteId);
void /*or IGitTfsRemote*/ CreateTfsRemote(string remoteId, string tfsUrl, string tfsRepositoryPath, RemoteOptions remoteOptions);
Expand Down

0 comments on commit 2270c1b

Please sign in to comment.