Globals: remove unused property StartingRepositorySubDir

The property is set in class GitTfs by calling `git rev-parse --show-prefix`
but it is never used. Remove it and also the useless invocation of git
rev-parse to improve the overall startup time of git-tfs.

For me this leads to a reduction of round about 85 ms in startup time,
as can be seen in the measurement with hyperfine.

# Version before this change
c:\src\git-tfs>hyperfine --warmup=3 -i src\GitTfs\bin\Debug\net472\git-tfs.exe
Benchmark 1: src\GitTfs\bin\Debug\net472\git-tfs.exe
  Time (mean ± s):     825.7 ms ±  15.5 ms    [User: 5.4 ms, System: 16.1 ms]
  Range (min … max):   800.8 ms … 852.0 ms    10 runs

  Warning: Ignoring non-zero exit code.

# Version with this change
c:\src\git-tfs>hyperfine --warmup=3 -i src\GitTfs\bin\Debug\net472\git-tfs.exe
Benchmark 1: src\GitTfs\bin\Debug\net472\git-tfs.exe
  Time (mean ± s):     740.9 ms ±  30.8 ms    [User: 3.4 ms, System: 23.4 ms]
  Range (min … max):   695.4 ms … 792.3 ms    10 runs
This commit is contained in:
Peter Baumann
2021-12-01 19:42:44 +01:00
committed by siprbaum
parent 01e53e9240
commit bf36944971
2 changed files with 0 additions and 11 deletions
-9
View File
@@ -111,15 +111,6 @@ namespace GitTfs
public void InitializeGlobals()
{
var git = _container.GetInstance<IGitHelpers>();
try
{
_globals.StartingRepositorySubDir = git.CommandOneline("rev-parse", "--show-prefix");
}
catch (Exception)
{
_globals.StartingRepositorySubDir = "";
}
if (_globals.GitDir != null)
{
_globals.GitDirSetByUser = true;
-2
View File
@@ -96,8 +96,6 @@ namespace GitTfs
public bool GitDirSetByUser { get; set; }
public string StartingRepositorySubDir { get; set; }
public IGitRepository Repository { get; set; }
public int GcCountdown { get; set; }